@@ -134,6 +134,84 @@ typedef struct
134
134
#define UtAssert_Type (Type ,Expression ,...) \
135
135
UtAssertEx(Expression, UTASSERT_CASETYPE_##Type, __FILE__, __LINE__, __VA_ARGS__)
136
136
137
+ /**
138
+ * \brief Compare two values for equality with an auto-generated description message
139
+ * Values will be compared in an "int32" type context.
140
+ */
141
+ #define UtAssert_INT32_EQ (actual ,expect ) do \
142
+ { \
143
+ int32 rcexp = (int32)(expect); \
144
+ int32 rcact = (int32)(actual); \
145
+ UtAssert_True(rcact == rcexp, "%s (%ld) == %s (%ld)", \
146
+ #actual, (long)rcact, \
147
+ #expect, (long)rcexp); \
148
+ } while(0)
149
+
150
+ /**
151
+ * \brief Compare two values for equality with an auto-generated description message
152
+ * Values will be compared in an "uint32" type context.
153
+ */
154
+ #define UtAssert_UINT32_EQ (actual ,expect ) do \
155
+ { \
156
+ uint32 rcexp = (uint32)(expect); \
157
+ uint32 rcact = (uint32)(actual); \
158
+ UtAssert_True(rcact == rcexp, "%s (%lu) == %s (%lu)", \
159
+ #actual, (unsigned long)rcact, \
160
+ #expect, (unsigned long)rcexp); \
161
+ } while(0)
162
+
163
+ /**
164
+ * \brief Confirm a pointer value is not NULL
165
+ */
166
+ #define UtAssert_NOT_NULL (actual ) do \
167
+ { \
168
+ void* ptr = (void*)(actual); \
169
+ UtAssert_True(ptr != NULL, "%s (%p) != NULL", \
170
+ #actual, ptr); \
171
+ } while(0)
172
+
173
+ /**
174
+ * \brief Confirm a pointer value is NULL
175
+ */
176
+ #define UtAssert_NULL (actual ) do \
177
+ { \
178
+ void* ptr = (void*)(actual); \
179
+ UtAssert_True(ptr == NULL, "%s (%p) == NULL", \
180
+ #actual, ptr); \
181
+ } while(0)
182
+
183
+ /**
184
+ * \brief Confirm an integer value is nonzero
185
+ */
186
+ #define UtAssert_NONZERO (actual ) do \
187
+ { \
188
+ long val = (long)(actual); \
189
+ UtAssert_True(val != 0, "%s (%ld) != 0", \
190
+ #actual, val); \
191
+ } while(0)
192
+
193
+ /**
194
+ * \brief Confirm an integer value is nonzero
195
+ */
196
+ #define UtAssert_ZERO (actual ) do \
197
+ { \
198
+ long val = (long)(actual); \
199
+ UtAssert_True(val == 0, "%s (%ld) == 0", \
200
+ #actual, val); \
201
+ } while(0)
202
+
203
+ /**
204
+ * \brief Confirm that a stub function has been invoked the expected number of times
205
+ */
206
+ #define UtAssert_STUB_COUNT (stub ,expected ) do \
207
+ { \
208
+ uint32 expval = (uint32)(expected); \
209
+ uint32 actval = UT_GetStubCount(UT_KEY(stub)); \
210
+ UtAssert_True(actval == expval, "%s() count (%lu) == %s (%lu)", \
211
+ #stub, (unsigned long)actval, \
212
+ #expected, (unsigned long)expval); \
213
+ } while(0)
214
+
137
215
/*
138
216
* Exported Functions
139
217
*/
0 commit comments