Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/micromock/unittests/micromocktest/hypothetic_module.c

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 /*defines*/
5 #include "stdafx_c.h"
6 #include "hypothetic_module.h"
7 #include "hypothetic_module_interfaces.h"
8
9 #define SHADOW_BUFFER_SIZE 100
10 /*types*/
11 typedef struct data_tag
12 {
13 int wasZeroCalled;
14
15 int wasizeroCalled;
16
17 int wasoneCalled;
18 int ioneiShadow;
19
20 int wastwoCalled;
21 char twosShadow[SHADOW_BUFFER_SIZE];
22 int twoiShadow;
23
24 int wasthreeCalled;
25 char threecShadow;
26 char threesShadow[SHADOW_BUFFER_SIZE];
27 int threeiShadow;
28
29 int wasfourCalled;
30 unsigned short int foursiShadow;
31 char fourcShadow;
32 char foursShadow[SHADOW_BUFFER_SIZE];
33 int fouriShadow;
34
35 int wasfiveCalled;
36 pVoidFunction fivepVoidShadow;
37 unsigned short int fivesiShadow;
38 char fivecShadow;
39 char fivesShadow[SHADOW_BUFFER_SIZE];
40 int fiveiShadow;
41
42 int wassixCalled;
43 char sixc1Shadow ,sixc2Shadow ,sixc3Shadow ,sixc4Shadow ,sixc5Shadow ,sixc6Shadow;
44 }data;
45 /*static variables*/
46 static data d;
47 /*static functions*/
48 /*variable exports*/
49 /*function exports*/
50 void zero(void)
51 {
52 d.wasZeroCalled=1;
53 }
54
55 int izero(void)
56 {
57 d.wasizeroCalled=1;
58 return 0;
59 }
60
61 int one(_In_ int i)
62 {
63 d.wasoneCalled=1;
64 d.ioneiShadow=i;
65 return 0;
66 }
67
68 int two(_In_z_ pChar s, _In_ int i)
69 {
70 d.wastwoCalled=1;
71 strcpy_s(d.twosShadow, SHADOW_BUFFER_SIZE,s);
72 //d.twosShadow[0]=s;
73
74 d.twoiShadow = i;
75 return 0;
76 }
77
78 int three(_In_ char c, _In_z_ pChar s, _In_ int i)
79 {
80 d.wasthreeCalled=1;
81 d.threecShadow=c;
82 strcpy_s(d.threesShadow, SHADOW_BUFFER_SIZE, s);
83 //d.threesShadow[0]=s;
84 d.threeiShadow = i;
85 return 0;
86 }
87
88 int four(_In_ unsigned short int si, _In_ char c, _In_z_ pChar s, _In_ int i)
89 {
90 d.wasfourCalled=1;
91 d.foursiShadow = si;
92 d.fourcShadow=c;
93 strcpy_s(d.foursShadow, SHADOW_BUFFER_SIZE, s);
94 //d.foursShadow[0]=s;
95 d.fouriShadow = i;
96 return 0;
97 }
98
99 int five(_In_opt_ pVoidFunction pVoid, _In_ unsigned short int si, _In_ char c, _In_z_ pChar s, _In_ int i)
100 {
101 d.wasfiveCalled=1;
102 d.fivepVoidShadow = pVoid;
103 d.fivesiShadow = si;
104 d.fivecShadow=c;
105 strcpy_s(d.fivesShadow, SHADOW_BUFFER_SIZE, s);
106 //d.fivesShadow[0]=s;
107 d.fiveiShadow = i;
108 return 0;
109 }
110
111 int six(_In_ char c1, _In_ char c2, _In_ char c3, _In_ char c4, _In_ char c5, _In_ char c6)
112 {
113 d.wassixCalled=1;
114 d.sixc1Shadow=c1;
115 d.sixc2Shadow=c2;
116 d.sixc3Shadow=c3;
117 d.sixc4Shadow=c4;
118 d.sixc5Shadow=c5;
119 d.sixc6Shadow=c6;
120 return 0;
121 }
122
123 void theTask(void)
124 {
125 if(d.wasZeroCalled)
126 {
127 d.wasZeroCalled=0;
128 whenzero();
129 }
130
131 if(d.wasizeroCalled)
132 {
133 d.wasizeroCalled=0;
134 whenizero();
135 }
136
137 if(d.wasoneCalled)
138 {
139 d.wasoneCalled=0;
140 whenone(d.ioneiShadow+1);
141 }
142
143 if(d.wastwoCalled)
144 {
145 d.wastwoCalled=0;
146 whentwo(d.twosShadow, d.twoiShadow+2);
147 }
148
149 if(d.wasthreeCalled)
150 {
151 d.wasthreeCalled=0;
152 whenthree(d.threecShadow+3, d.threesShadow, d.threeiShadow+3);
153 }
154
155 if(d.wasfourCalled)
156 {
157 d.wasfourCalled=0;
158 whenfour(d.foursiShadow+4, d.fourcShadow+4, d.foursShadow, d.fouriShadow+4);
159 }
160
161 if(d.wasfiveCalled)
162 {
163 d.wasfiveCalled=0;
164 whenfive(d.fivepVoidShadow, d.fivesiShadow+5, d.fivecShadow+5, d.fivesShadow, d.fiveiShadow+5);
165 }
166
167 if(d.wassixCalled)
168 {
169 d.wassixCalled=0;
170 whensix(d.sixc1Shadow+6,d.sixc2Shadow+6,d.sixc3Shadow+6,d.sixc4Shadow+6,d.sixc5Shadow+6,d.sixc6Shadow+6);
171 }
172
173
174 }
175