| 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 |
#include "ctest.h" |
| 5 |
|
| 6 |
CTEST_BEGIN_TEST_SUITE(AssertSuccessTests) |
| 7 |
|
| 8 |
typedef struct mystruct_tag |
| 9 |
{ |
| 10 |
unsigned char x; |
| 11 |
} mystruct; |
| 12 |
|
| 13 |
CTEST_COMPARE(mystruct_ptr, mystruct*) |
| 14 |
{ |
| 15 |
return (left->x != right->x); |
| 16 |
} |
| 17 |
|
| 18 |
CTEST_TO_STRING(mystruct_ptr, mystruct*, string, bufferSize, value) |
| 19 |
{ |
| 20 |
(void)snprintf(string, bufferSize, "{ %d }", (int)value->x); |
| 21 |
} |
| 22 |
|
| 23 |
/* CTEST_ASSERT_ARE_EQUAL */ |
| 24 |
|
| 25 |
CTEST_FUNCTION(Assert_Are_Equal_2_Ints_Succeeds) |
| 26 |
{ |
| 27 |
CTEST_ASSERT_ARE_EQUAL(int, 1, 1); |
| 28 |
} |
| 29 |
|
| 30 |
CTEST_FUNCTION(Assert_Are_Equal_2_Chars_Succeeds) |
| 31 |
{ |
| 32 |
CTEST_ASSERT_ARE_EQUAL(char, (char)1, (char)1); |
| 33 |
} |
| 34 |
|
| 35 |
CTEST_FUNCTION(Assert_Are_Equal_2_Shorts_Succeeds) |
| 36 |
{ |
| 37 |
CTEST_ASSERT_ARE_EQUAL(short, (short)1, (short)1); |
| 38 |
} |
| 39 |
|
| 40 |
CTEST_FUNCTION(Assert_Are_Equal_2_Longs_Succeeds) |
| 41 |
{ |
| 42 |
CTEST_ASSERT_ARE_EQUAL(long, (long)1, (long)1); |
| 43 |
} |
| 44 |
|
| 45 |
CTEST_FUNCTION(Assert_Are_Equal_2_Unsigned_Longs_Succeeds) |
| 46 |
{ |
| 47 |
CTEST_ASSERT_ARE_EQUAL(unsigned_long, 1UL, 1UL); |
| 48 |
} |
| 49 |
|
| 50 |
CTEST_FUNCTION(Assert_Are_Equal_2_uint8_t_Succeeds) |
| 51 |
{ |
| 52 |
CTEST_ASSERT_ARE_EQUAL(uint8_t, (uint8_t)1, (uint8_t)1); |
| 53 |
} |
| 54 |
|
| 55 |
CTEST_FUNCTION(Assert_Are_Equal_2_int8_t_Succeeds) |
| 56 |
{ |
| 57 |
CTEST_ASSERT_ARE_EQUAL(int8_t, (int8_t)1, (int8_t)1); |
| 58 |
} |
| 59 |
|
| 60 |
CTEST_FUNCTION(Assert_Are_Equal_2_uint16_t_Succeeds) |
| 61 |
{ |
| 62 |
CTEST_ASSERT_ARE_EQUAL(uint16_t, (uint16_t)1, (uint16_t)1); |
| 63 |
} |
| 64 |
|
| 65 |
CTEST_FUNCTION(Assert_Are_Equal_2_int16_t_Succeeds) |
| 66 |
{ |
| 67 |
CTEST_ASSERT_ARE_EQUAL(int16_t, (int16_t)1, (int16_t)1); |
| 68 |
} |
| 69 |
|
| 70 |
CTEST_FUNCTION(Assert_Are_Equal_2_uint32_t_Succeeds) |
| 71 |
{ |
| 72 |
CTEST_ASSERT_ARE_EQUAL(uint32_t, (uint32_t)1, (uint32_t)1); |
| 73 |
} |
| 74 |
|
| 75 |
CTEST_FUNCTION(Assert_Are_Equal_2_int32_t_Succeeds) |
| 76 |
{ |
| 77 |
CTEST_ASSERT_ARE_EQUAL(int32_t, (int32_t)1, (int32_t)1); |
| 78 |
} |
| 79 |
|
| 80 |
CTEST_FUNCTION(Assert_Are_Equal_2_uint64_t_Succeeds) |
| 81 |
{ |
| 82 |
CTEST_ASSERT_ARE_EQUAL(uint64_t, (uint64_t)1, (uint64_t)1); |
| 83 |
} |
| 84 |
|
| 85 |
CTEST_FUNCTION(Assert_Are_Equal_2_int64_t_Succeeds) |
| 86 |
{ |
| 87 |
CTEST_ASSERT_ARE_EQUAL(int64_t, (int64_t)1, (int64_t)1); |
| 88 |
} |
| 89 |
|
| 90 |
CTEST_FUNCTION(Assert_Are_Equal_2_strings_With_To_String_Type_Succeeds) |
| 91 |
{ |
| 92 |
CTEST_ASSERT_ARE_EQUAL(char_ptr, "dan", "dan"); |
| 93 |
} |
| 94 |
|
| 95 |
CTEST_FUNCTION(Assert_Are_Equal_2_wide_strings_With_To_String_Type_Succeeds) |
| 96 |
{ |
| 97 |
CTEST_ASSERT_ARE_EQUAL(wchar_ptr, L"matt", L"matt"); |
| 98 |
} |
| 99 |
|
| 100 |
CTEST_FUNCTION(Assert_Are_Equal_2_strings_With_Same_Address_Succeeds) |
| 101 |
{ |
| 102 |
char c1; |
| 103 |
CTEST_ASSERT_ARE_EQUAL(void_ptr, &c1, &c1); |
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
CTEST_FUNCTION(Assert_Are_Equal_2_Structures_Succeeds) |
| 108 |
{ |
| 109 |
mystruct a = { 1 }; |
| 110 |
mystruct b = { 1 }; |
| 111 |
|
| 112 |
CTEST_ASSERT_ARE_EQUAL(mystruct_ptr, &a, &b); |
| 113 |
} |
| 114 |
|
| 115 |
/* CTEST_ASSERT_ARE_EQUAL with custom message string */ |
| 116 |
|
| 117 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_Ints_Succeeds) |
| 118 |
{ |
| 119 |
CTEST_ASSERT_ARE_EQUAL(int, 1, 1, "Test message"); |
| 120 |
} |
| 121 |
|
| 122 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_Chars_Succeeds) |
| 123 |
{ |
| 124 |
CTEST_ASSERT_ARE_EQUAL(char, (char)1, (char)1, "Test message"); |
| 125 |
} |
| 126 |
|
| 127 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_Shorts_Succeeds) |
| 128 |
{ |
| 129 |
CTEST_ASSERT_ARE_EQUAL(short, (short)1, (short)1, "Test message"); |
| 130 |
} |
| 131 |
|
| 132 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_Longs_Succeeds) |
| 133 |
{ |
| 134 |
CTEST_ASSERT_ARE_EQUAL(long, (long)1, (long)1, "Test message"); |
| 135 |
} |
| 136 |
|
| 137 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_Unsigned_Longs_Succeeds) |
| 138 |
{ |
| 139 |
CTEST_ASSERT_ARE_EQUAL(unsigned_long, 1UL, 1UL, "Test message"); |
| 140 |
} |
| 141 |
|
| 142 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_uint8_t_Succeeds) |
| 143 |
{ |
| 144 |
CTEST_ASSERT_ARE_EQUAL(uint8_t, (uint8_t)1, (uint8_t)1, "Test message"); |
| 145 |
} |
| 146 |
|
| 147 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_int8_t_Succeeds) |
| 148 |
{ |
| 149 |
CTEST_ASSERT_ARE_EQUAL(int8_t, (int8_t)1, (int8_t)1, "Test message"); |
| 150 |
} |
| 151 |
|
| 152 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_uint16_t_Succeeds) |
| 153 |
{ |
| 154 |
CTEST_ASSERT_ARE_EQUAL(uint16_t, (uint16_t)1, (uint16_t)1, "Test message"); |
| 155 |
} |
| 156 |
|
| 157 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_int16_t_Succeeds) |
| 158 |
{ |
| 159 |
CTEST_ASSERT_ARE_EQUAL(int16_t, (int16_t)1, (int16_t)1, "Test message"); |
| 160 |
} |
| 161 |
|
| 162 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_uint32_t_Succeeds) |
| 163 |
{ |
| 164 |
CTEST_ASSERT_ARE_EQUAL(uint32_t, (uint32_t)1, (uint32_t)1, "Test message"); |
| 165 |
} |
| 166 |
|
| 167 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_int32_t_Succeeds) |
| 168 |
{ |
| 169 |
CTEST_ASSERT_ARE_EQUAL(int32_t, (int32_t)1, (int32_t)1, "Test message"); |
| 170 |
} |
| 171 |
|
| 172 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_uint64_t_Succeeds) |
| 173 |
{ |
| 174 |
CTEST_ASSERT_ARE_EQUAL(uint64_t, (uint64_t)1, (uint64_t)1, "Test message"); |
| 175 |
} |
| 176 |
|
| 177 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_int64_t_Succeeds) |
| 178 |
{ |
| 179 |
CTEST_ASSERT_ARE_EQUAL(int64_t, (int64_t)1, (int64_t)1, "Test message"); |
| 180 |
} |
| 181 |
|
| 182 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_strings_With_To_String_Type_Succeeds) |
| 183 |
{ |
| 184 |
CTEST_ASSERT_ARE_EQUAL(char_ptr, "dan", "dan", "Test message"); |
| 185 |
} |
| 186 |
|
| 187 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_wide_strings_With_To_String_Type_Succeeds) |
| 188 |
{ |
| 189 |
CTEST_ASSERT_ARE_EQUAL(wchar_ptr, L"matt", L"matt", "Test message"); |
| 190 |
} |
| 191 |
|
| 192 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_void_ptr_same_address_Succeeds) |
| 193 |
{ |
| 194 |
char c1; |
| 195 |
CTEST_ASSERT_ARE_EQUAL(void_ptr, &c1, &c1, "Test message"); |
| 196 |
} |
| 197 |
|
| 198 |
CTEST_FUNCTION(Assert_Are_Equal_With_Msg_2_Structures_Succeeds) |
| 199 |
{ |
| 200 |
mystruct a = { 1 }; |
| 201 |
mystruct b = { 1 }; |
| 202 |
|
| 203 |
CTEST_ASSERT_ARE_EQUAL(mystruct_ptr, &a, &b, "Test message"); |
| 204 |
} |
| 205 |
|
| 206 |
/* CTEST_ASSERT_ARE_NOT_EQUAL */ |
| 207 |
|
| 208 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_Ints_Succeeds) |
| 209 |
{ |
| 210 |
CTEST_ASSERT_ARE_NOT_EQUAL(int, 0, 1); |
| 211 |
} |
| 212 |
|
| 213 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_Chars_Succeeds) |
| 214 |
{ |
| 215 |
CTEST_ASSERT_ARE_NOT_EQUAL(char, (char)0, (char)1); |
| 216 |
} |
| 217 |
|
| 218 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_Shorts_Succeeds) |
| 219 |
{ |
| 220 |
CTEST_ASSERT_ARE_NOT_EQUAL(short, (short)0, (short)1); |
| 221 |
} |
| 222 |
|
| 223 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_Longs_Succeeds) |
| 224 |
{ |
| 225 |
CTEST_ASSERT_ARE_NOT_EQUAL(long, (long)0, (long)1); |
| 226 |
} |
| 227 |
|
| 228 |
#if defined CTEST_USE_STDINT |
| 229 |
|
| 230 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_uint8_t_Succeeds) |
| 231 |
{ |
| 232 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint8_t, (uint8_t)0, (uint8_t)1); |
| 233 |
} |
| 234 |
|
| 235 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_int8_t_Succeeds) |
| 236 |
{ |
| 237 |
CTEST_ASSERT_ARE_NOT_EQUAL(int8_t, (int8_t)0, (int8_t)1); |
| 238 |
} |
| 239 |
|
| 240 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_uint16_t_Succeeds) |
| 241 |
{ |
| 242 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint16_t, (uint16_t)0, (uint16_t)1); |
| 243 |
} |
| 244 |
|
| 245 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_int16_t_Succeeds) |
| 246 |
{ |
| 247 |
CTEST_ASSERT_ARE_NOT_EQUAL(int16_t, (int16_t)0, (int16_t)1); |
| 248 |
} |
| 249 |
|
| 250 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_uint32_t_Succeeds) |
| 251 |
{ |
| 252 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint32_t, (uint32_t)0, (uint32_t)1); |
| 253 |
} |
| 254 |
|
| 255 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_int32_t_Succeeds) |
| 256 |
{ |
| 257 |
CTEST_ASSERT_ARE_NOT_EQUAL(int32_t, (int32_t)0, (int32_t)1); |
| 258 |
} |
| 259 |
|
| 260 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_uint64_t_Succeeds) |
| 261 |
{ |
| 262 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint64_t, (uint64_t)0, (uint64_t)1); |
| 263 |
} |
| 264 |
|
| 265 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_int64_t_Succeeds) |
| 266 |
{ |
| 267 |
CTEST_ASSERT_ARE_NOT_EQUAL(int64_t, (int64_t)0, (int64_t)1); |
| 268 |
} |
| 269 |
|
| 270 |
#endif |
| 271 |
|
| 272 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_strings_With_To_String_Type_Succeeds) |
| 273 |
{ |
| 274 |
CTEST_ASSERT_ARE_NOT_EQUAL(char_ptr, "test", "dan"); |
| 275 |
} |
| 276 |
|
| 277 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_wide_strings_With_To_String_Type_Succeeds) |
| 278 |
{ |
| 279 |
CTEST_ASSERT_ARE_NOT_EQUAL(wchar_ptr, L"test", L"matt"); |
| 280 |
} |
| 281 |
|
| 282 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_void_ptr_different_address_Succeeds) |
| 283 |
{ |
| 284 |
int c1, c2; |
| 285 |
CTEST_ASSERT_ARE_NOT_EQUAL(void_ptr, &c1, &c2); |
| 286 |
} |
| 287 |
|
| 288 |
CTEST_FUNCTION(Assert_Are_Not_Equal_2_Structures_Succeeds) |
| 289 |
{ |
| 290 |
mystruct a = { 1 }; |
| 291 |
mystruct b = { 42 }; |
| 292 |
|
| 293 |
CTEST_ASSERT_ARE_NOT_EQUAL(mystruct_ptr, &a, &b); |
| 294 |
} |
| 295 |
|
| 296 |
/* CTEST_ASSERT_ARE_NOT_EQUAL with custom message string */ |
| 297 |
|
| 298 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_Ints_Succeeds) |
| 299 |
{ |
| 300 |
CTEST_ASSERT_ARE_NOT_EQUAL(int, 0, 1, "Test message"); |
| 301 |
} |
| 302 |
|
| 303 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_Chars_Succeeds) |
| 304 |
{ |
| 305 |
CTEST_ASSERT_ARE_NOT_EQUAL(char, (char)0, (char)1, "Test message"); |
| 306 |
} |
| 307 |
|
| 308 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_Shorts_Succeeds) |
| 309 |
{ |
| 310 |
CTEST_ASSERT_ARE_NOT_EQUAL(short, (short)0, (short)1, "Test message"); |
| 311 |
} |
| 312 |
|
| 313 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_Longs_Succeeds) |
| 314 |
{ |
| 315 |
CTEST_ASSERT_ARE_NOT_EQUAL(long, (long)0, (long)1, "Test message"); |
| 316 |
} |
| 317 |
|
| 318 |
#if defined CTEST_USE_STDINT |
| 319 |
|
| 320 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_uint8_t_Succeeds) |
| 321 |
{ |
| 322 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint8_t, (uint8_t)0, (uint8_t)1, "Test message"); |
| 323 |
} |
| 324 |
|
| 325 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_int8_t_Succeeds) |
| 326 |
{ |
| 327 |
CTEST_ASSERT_ARE_NOT_EQUAL(int8_t, (int8_t)0, (int8_t)1, "Test message"); |
| 328 |
} |
| 329 |
|
| 330 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_uint16_t_Succeeds) |
| 331 |
{ |
| 332 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint16_t, (uint16_t)0, (uint16_t)1, "Test message"); |
| 333 |
} |
| 334 |
|
| 335 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_int16_t_Succeeds) |
| 336 |
{ |
| 337 |
CTEST_ASSERT_ARE_NOT_EQUAL(int16_t, (int16_t)0, (int16_t)1, "Test message"); |
| 338 |
} |
| 339 |
|
| 340 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_uint32_t_Succeeds) |
| 341 |
{ |
| 342 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint32_t, (uint32_t)0, (uint32_t)1, "Test message"); |
| 343 |
} |
| 344 |
|
| 345 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_int32_t_Succeeds) |
| 346 |
{ |
| 347 |
CTEST_ASSERT_ARE_NOT_EQUAL(int32_t, (int32_t)0, (int32_t)1, "Test message"); |
| 348 |
} |
| 349 |
|
| 350 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_uint64_t_Succeeds) |
| 351 |
{ |
| 352 |
CTEST_ASSERT_ARE_NOT_EQUAL(uint64_t, (uint64_t)0, (uint64_t)1, "Test message"); |
| 353 |
} |
| 354 |
|
| 355 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_int64_t_Succeeds) |
| 356 |
{ |
| 357 |
CTEST_ASSERT_ARE_NOT_EQUAL(int64_t, (int64_t)0, (int64_t)1, "Test message"); |
| 358 |
} |
| 359 |
|
| 360 |
#endif |
| 361 |
|
| 362 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_strings_With_To_String_Type_Succeeds) |
| 363 |
{ |
| 364 |
CTEST_ASSERT_ARE_NOT_EQUAL(char_ptr, "test", "dan", "Test message"); |
| 365 |
} |
| 366 |
|
| 367 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_wide_strings_With_To_String_Type_Succeeds) |
| 368 |
{ |
| 369 |
CTEST_ASSERT_ARE_NOT_EQUAL(wchar_ptr, L"test", L"matt", "Test message"); |
| 370 |
} |
| 371 |
|
| 372 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_void_ptr_with_different_addresses_Succeeds) |
| 373 |
{ |
| 374 |
double b1, b2; |
| 375 |
CTEST_ASSERT_ARE_NOT_EQUAL(void_ptr, &b1, &b2, "Test message"); |
| 376 |
} |
| 377 |
|
| 378 |
CTEST_FUNCTION(Assert_Are_Not_Equal_With_Msg_2_Structures_Succeeds) |
| 379 |
{ |
| 380 |
mystruct a = { 1 }; |
| 381 |
mystruct b = { 42 }; |
| 382 |
|
| 383 |
CTEST_ASSERT_ARE_NOT_EQUAL(mystruct_ptr, &a, &b, "Test message"); |
| 384 |
} |
| 385 |
|
| 386 |
/* CTEST_ASSERT_IS_NULL */ |
| 387 |
|
| 388 |
CTEST_FUNCTION(Assert_Is_NULL_Succeeds) |
| 389 |
{ |
| 390 |
void* test_value = NULL; |
| 391 |
CTEST_ASSERT_IS_NULL(test_value); |
| 392 |
} |
| 393 |
|
| 394 |
/* CTEST_ASSERT_IS_NULL with custom message string */ |
| 395 |
|
| 396 |
CTEST_FUNCTION(Assert_Is_NULL_With_Msg_Succeeds) |
| 397 |
{ |
| 398 |
void* test_value = NULL; |
| 399 |
CTEST_ASSERT_IS_NULL(test_value, "Test message"); |
| 400 |
} |
| 401 |
|
| 402 |
/* CTEST_ASSERT_IS_NOT_NULL */ |
| 403 |
|
| 404 |
CTEST_FUNCTION(Assert_Is_Not_NULL_Succeeds) |
| 405 |
{ |
| 406 |
int a; |
| 407 |
int *ptr = &a; |
| 408 |
CTEST_ASSERT_IS_NOT_NULL(ptr); |
| 409 |
} |
| 410 |
|
| 411 |
/* CTEST_ASSERT_IS_NOT_NULL with custom message string */ |
| 412 |
|
| 413 |
CTEST_FUNCTION(Assert_Is_Not_NULL_With_Msg_Succeeds) |
| 414 |
{ |
| 415 |
int a; |
| 416 |
int *ptr = &a; |
| 417 |
CTEST_ASSERT_IS_NOT_NULL(ptr, "Test message"); |
| 418 |
} |
| 419 |
|
| 420 |
/* CTEST_ASSERT_IS_TRUE */ |
| 421 |
|
| 422 |
CTEST_FUNCTION(Assert_Is_True_Succeeds) |
| 423 |
{ |
| 424 |
int tested_value = 1; |
| 425 |
CTEST_ASSERT_IS_TRUE(tested_value); |
| 426 |
} |
| 427 |
|
| 428 |
/* CTEST_ASSERT_IS_TRUE with custom message string */ |
| 429 |
|
| 430 |
CTEST_FUNCTION(Assert_Is_True_With_Msg_Succeeds) |
| 431 |
{ |
| 432 |
int tested_value = 1; |
| 433 |
CTEST_ASSERT_IS_TRUE(tested_value, "Test message"); |
| 434 |
} |
| 435 |
|
| 436 |
/* CTEST_ASSERT_IS_FALSE */ |
| 437 |
|
| 438 |
CTEST_FUNCTION(Assert_Is_False_Succeeds) |
| 439 |
{ |
| 440 |
int tested_value = 0; |
| 441 |
CTEST_ASSERT_IS_FALSE(tested_value); |
| 442 |
} |
| 443 |
|
| 444 |
/* CTEST_ASSERT_IS_FALSE with custom message string */ |
| 445 |
|
| 446 |
CTEST_FUNCTION(Assert_Is_False_With_Msg_Succeeds) |
| 447 |
{ |
| 448 |
int tested_value = 0; |
| 449 |
CTEST_ASSERT_IS_FALSE(tested_value, "Test message"); |
| 450 |
} |
| 451 |
|
| 452 |
/* #define'd type */ |
| 453 |
|
| 454 |
#define my_type int |
| 455 |
|
| 456 |
CTEST_FUNCTION(Assert_Are_Equal_with_defined_type_succeeds) |
| 457 |
{ |
| 458 |
my_type tested_value = 0; |
| 459 |
CTEST_ASSERT_ARE_EQUAL(my_type, 0, tested_value); |
| 460 |
} |
| 461 |
|
| 462 |
CTEST_FUNCTION(Assert_Are_Not_Equal_with_defined_type_succeeds) |
| 463 |
{ |
| 464 |
my_type tested_value = 0; |
| 465 |
CTEST_ASSERT_ARE_NOT_EQUAL(my_type, 1, tested_value); |
| 466 |
} |
| 467 |
|
| 468 |
CTEST_END_TEST_SUITE(AssertSuccessTests) |