Xin Zhang / azure-iot-c-sdk-f767zi

Dependents:   samplemqtt

Revision:
0:f7f1f0d76dd6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uamqp/deps/umock-c/inc/umock_c_prod.h	Thu Aug 23 06:52:14 2018 +0000
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+#undef MOCKABLE_FUNCTION
+
+/* This header is meant to be included by production code headers, so that the MOCKABLE_FUNCTION gets enabled. */
+/* 
+    If you are porting to a new platform and do not want to build the tests, but only the production code,
+    simply make sure that this file is in the include path (either by copying it to your inc folder or 
+    by adjusting the include paths).
+*/
+
+#ifdef ENABLE_MOCKS
+
+#ifdef ENABLE_MOCK_FILTERING
+#define ENABLE_MOCK_FILTERING_SWITCH 1
+#else
+#define ENABLE_MOCK_FILTERING_SWITCH 0
+#endif
+
+#include "macro_utils.h"
+
+#define UMOCK_C_PROD_ARG_IN_SIGNATURE(count, arg_type, arg_name) arg_type arg_name IFCOMMA(count)
+
+#define MOCKABLE_FUNCTION_DISABLED(modifiers, result, function, ...) \
+    result modifiers function(IF(COUNT_ARG(__VA_ARGS__), , void) FOR_EACH_2_COUNTED(UMOCK_C_PROD_ARG_IN_SIGNATURE, __VA_ARGS__));
+
+/* Codes_SRS_UMOCK_C_LIB_01_001: [MOCKABLE_FUNCTION shall be used to wrap function definition allowing the user to declare a function that can be mocked.]*/
+#define MOCKABLE_FUNCTION(modifiers, result, function, ...) \
+    IF(ENABLE_MOCK_FILTERING_SWITCH,IF(C2(please_mock_, function),MOCKABLE_FUNCTION_DISABLED,MOCKABLE_FUNCTION_UMOCK_INTERNAL_WITH_MOCK), MOCKABLE_FUNCTION_UMOCK_INTERNAL_WITH_MOCK) (modifiers, result, function, __VA_ARGS__)
+
+#include "umock_c.h"
+
+#else
+
+#include "macro_utils.h"
+
+#define UMOCK_C_PROD_ARG_IN_SIGNATURE(count, arg_type, arg_name) arg_type arg_name IFCOMMA(count)
+
+/* Codes_SRS_UMOCK_C_LIB_01_002: [The macro shall generate a function signature in case ENABLE_MOCKS is not defined.] */
+/* Codes_SRS_UMOCK_C_LIB_01_005: [**If ENABLE_MOCKS is not defined, MOCKABLE_FUNCTION shall only generate a declaration for the function.] */
+/* Codes_SRS_UMOCK_C_LIB_01_001: [MOCKABLE_FUNCTION shall be used to wrap function definition allowing the user to declare a function that can be mocked.]*/
+#define MOCKABLE_FUNCTION(modifiers, result, function, ...) \
+    result modifiers function(IF(COUNT_ARG(__VA_ARGS__),,void) FOR_EACH_2_COUNTED(UMOCK_C_PROD_ARG_IN_SIGNATURE, __VA_ARGS__));
+
+#endif