Debian Codegraph @

src/vendor/azure-uamqp-c/deps/umock-c/tests/umock_c_int/test_dependency.h

raw
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 #ifndef TEST_DEPENDENCY_H
5 #define TEST_DEPENDENCY_H
6
7 #ifdef __cplusplus
8 #include <cstddef>
9 #else
10 #include <stddef.h>
11 #endif
12
13 #include "umock_c/umock_c_prod.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 typedef struct TEST_STRUCT_TAG
20 {
21 int x;
22 } TEST_STRUCT;
23
24 typedef struct TEST_STRUCT_WITH_2_MEMBERS_TAG
25 {
26 int x;
27 int y;
28 } TEST_STRUCT_WITH_2_MEMBERS;
29
30 typedef struct TEST_STRUCT_COPY_FAILS_TAG
31 {
32 int x;
33 } TEST_STRUCT_COPY_FAILS;
34
35 typedef struct TEST_STRUCT_NOT_REGISTERED
36 {
37 int x;
38 } TEST_STRUCT_NOT_REGISTERED;
39
40 typedef unsigned char ARRAY_TYPE[16];
41
42 /* Tests_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.]*/
43 /* Tests_SRS_UMOCK_C_LIB_01_004: [If ENABLE_MOCKS is defined, MOCKABLE_FUNCTION shall generate the declaration of the function and code for the mocked function, thus allowing setting up of expectations in test functions.] */
44 MOCKABLE_FUNCTION(, int, test_dependency_no_args);
45 MOCKABLE_FUNCTION(, int, test_dependency_1_arg, int, a);
46 MOCKABLE_FUNCTION(, void, test_dependency_1_arg_no_return, int, a);
47 MOCKABLE_FUNCTION(, int, test_dependency_2_args, int, a, int, b);
48 MOCKABLE_FUNCTION(, int, test_dependency_struct_arg, TEST_STRUCT, s);
49 MOCKABLE_FUNCTION(, const TEST_STRUCT*, test_dependency_return_const_struct_ptr);
50 MOCKABLE_FUNCTION(, int, test_dependency_struct_with_2_members, TEST_STRUCT_WITH_2_MEMBERS, s, int, a);
51 MOCKABLE_FUNCTION(, int, test_dependency_char_star_arg, char*, s);
52 MOCKABLE_FUNCTION(, int, test_dependency_1_out_arg, int*, a);
53 MOCKABLE_FUNCTION(, int, test_dependency_2_out_args, int*, a, int*, b);
54 MOCKABLE_FUNCTION(, void, test_dependency_void_return);
55 MOCKABLE_FUNCTION(, int*, test_dependency_int_ptr_return);
56 MOCKABLE_FUNCTION(, void, test_dependency_buffer_arg, unsigned char*, a);
57 MOCKABLE_FUNCTION(, int, test_dependency_global_mock_return_test);
58 MOCKABLE_FUNCTION(, TEST_STRUCT_COPY_FAILS, test_dependency_global_mock_return_copy_fails);
59 MOCKABLE_FUNCTION(, void, test_dependency_type_with_space, char *,s);
60 MOCKABLE_FUNCTION(, void, test_dependency_all_types, char, char_arg, unsigned char, unsignedchar_arg, short, short_arg, unsigned short, unsignedshort_arg, int, int_arg, unsigned int, unsignedint_arg, long, long_arg, unsigned long, unsignedlong_arg, long long, longlong_arg, unsigned long long, unsignedlonglong_arg, float, float_arg, double, double_arg, long double, longdouble_arg, size_t, size_t_arg, void*, void_ptr_arg, const void*, const_void_ptr_arg);
61 MOCKABLE_FUNCTION(, void, test_dependency_type_not_registered, TEST_STRUCT_NOT_REGISTERED, a);
62 MOCKABLE_FUNCTION(, int, test_dependency_with_global_mock_hook);
63 MOCKABLE_FUNCTION(, int, test_dependency_with_global_return);
64 MOCKABLE_FUNCTION(, int, test_dependency_returning_int);
65 MOCKABLE_FUNCTION(, char*, test_mock_function_returning_string);
66 MOCKABLE_FUNCTION(, char*, test_mock_function_returning_string_with_macro);
67 MOCKABLE_FUNCTION(, void, test_dependency_with_void_ptr, void*, argument);
68 MOCKABLE_FUNCTION(, void, test_dependency_with_const_void_ptr, const void*, argument);
69 MOCKABLE_FUNCTION(, void, test_dependency_with_array_arg, ARRAY_TYPE, argument);
70 MOCKABLE_FUNCTION(, void, test_dependency_with_volatile_arg, volatile int, argument);
71 MOCKABLE_FUNCTION(, void, test_dependency_with_volatile_pointer_arg, int volatile*, argument);
72 MOCKABLE_FUNCTION(, volatile void*, test_dependency_with_volatile_pptr_return);
73
74 typedef enum TEST_ENUM_TAG
75 {
76 TEST_ENUM_VALUE_1,
77 TEST_ENUM_VALUE_2
78 } TEST_ENUM;
79
80 MOCKABLE_FUNCTION(, void, test_mock_function_with_enum_type, TEST_ENUM, enum_type);
81
82 MOCKABLE_FUNCTION_WITH_RETURNS(, int, test_dependency_with_returns_no_args_returning_int)(42, 43);
83 MOCKABLE_FUNCTION_WITH_RETURNS(, void, test_dependency_with_no_return_works);
84 MOCKABLE_FUNCTION_WITH_RETURNS(, void*, test_dependency_with_returns_no_args_returning_void_ptr)((void*)0x4242, (void*)0x4243);
85 MOCKABLE_FUNCTION_WITH_RETURNS(, TEST_STRUCT, test_dependency_with_returns_no_args_returning_struct)({ 0x42 }, { 0x43 });
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* TEST_DEPENDENCY_H */