1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | #undef MOCKABLE_FUNCTION
|
---|
5 |
|
---|
6 | /* This header is meant to be included by production code headers, so that the MOCKABLE_FUNCTION gets enabled. */
|
---|
7 | /*
|
---|
8 | If you are porting to a new platform and do not want to build the tests, but only the production code,
|
---|
9 | simply make sure that this file is in the include path (either by copying it to your inc folder or
|
---|
10 | by adjusting the include paths).
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifdef ENABLE_MOCKS
|
---|
14 |
|
---|
15 | /* 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.]*/
|
---|
16 | #define MOCKABLE_FUNCTION(modifiers, result, function, ...) \
|
---|
17 | MOCKABLE_FUNCTION_UMOCK_INTERNAL_WITH_MOCK(modifiers, result, function, __VA_ARGS__)
|
---|
18 |
|
---|
19 | #include "umock_c.h"
|
---|
20 |
|
---|
21 | #else
|
---|
22 |
|
---|
23 | #include "azure_c_shared_utility/macro_utils.h"
|
---|
24 |
|
---|
25 | #define UMOCK_C_PROD_ARG_IN_SIGNATURE(count, arg_type, arg_name) arg_type arg_name MU_IFCOMMA(count)
|
---|
26 |
|
---|
27 | /* Codes_SRS_UMOCK_C_LIB_01_002: [The macro shall generate a function signature in case ENABLE_MOCKS is not defined.] */
|
---|
28 | /* Codes_SRS_UMOCK_C_LIB_01_005: [**If ENABLE_MOCKS is not defined, MOCKABLE_FUNCTION shall only generate a declaration for the function.] */
|
---|
29 | /* 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.]*/
|
---|
30 | #define MOCKABLE_FUNCTION(modifiers, result, function, ...) \
|
---|
31 | result modifiers function(MU_IF(MU_COUNT_ARG(__VA_ARGS__),,void) MU_FOR_EACH_2_COUNTED(UMOCK_C_PROD_ARG_IN_SIGNATURE, __VA_ARGS__));
|
---|
32 |
|
---|
33 | #endif
|
---|