From fb7854ef5dfc9557e44914e9ca59e7d54700f6bf Mon Sep 17 00:00:00 2001 From: Leonardo Date: Wed, 25 Sep 2019 16:41:40 -0300 Subject: [PATCH] Update assert.h and removed Added 3 new assertion macros: cmc_assert_array_equals_any cmc_assert_array_within_any cmc_assert_array_outside_any cmc_assert_array_sorted_any (renamed) --- src/utl/assert.h | 2156 +++++++++++++++++++++++++--------------------- 1 file changed, 1170 insertions(+), 986 deletions(-) diff --git a/src/utl/assert.h b/src/utl/assert.h index cc40689..d4348dd 100644 --- a/src/utl/assert.h +++ b/src/utl/assert.h @@ -40,9 +40,12 @@ * - ptr * - bool (only for equals and not_equals) * - * Specialized assertions: + * Specialized assertions that work with any data type: * - * - cmc_assert_sorted + * - cmc_assert_array_equals_any + * - cmc_assert_array_within_any + * - cmc_assert_array_outside_any + * - cmc_assert_array_sorted_any */ #ifndef CMC_ASSERT_H @@ -161,21 +164,154 @@ static bool cmc_assert_state = true; CMC_ASSERT_GLUE(dtype, not_in_range) \ (lower_bound, upper_bound, actual) +/** --------------------------------------------------------------------------- + * + * Any data type + * + * ------------------------------------------------------------------------ **/ + /** - * dtype : The type of the array - * array : Array to be checked if it is sorted + * Assert that two arrays are equal element by element. + * + * dtype : The type of the array. + * array1 : First array to be compared. + * array2 : Second array to be compared. + * comparator : A function that has two 'dtype' arguments and returns -1 if the + * first is less then the second, 0 if both are equal or 1 if the + * first is greater then the second. + * from_index : First index from both arrays to compare (inclusive). + * to_index : Last index from both arrays to compare (inclusive). + * + * This macro can be used for any data type. Both bounds are inclusive. + */ +#define cmc_assert_array_equals_any(dtype, array1, array2, comparator, from_index, to_index) \ + do \ + { \ + const char *str1__ = #array1; \ + const char *str2__ = #array2; \ + dtype *arr1__ = array1; \ + dtype *arr2__ = array2; \ + size_t from__ = from_index; \ + size_t to__ = to_index; \ + int (*cmp__)(dtype, dtype) = comparator; \ + \ + for (size_t i__ = from__; i__ <= to__; i__++) \ + { \ + if (cmp__(arr1__[i__], arr2__[i__]) != 0) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s and %s }: Arrays values are not equal at index %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str1__, str2__, i__); \ + \ + break; \ + } \ + } \ + \ + } while (0) + +/** + * Assert that each element in the array are within bounds. + * + * dtype : The type of the array. + * array : Array to be checked if its elements are within a given range + * comparator : A function that has two 'dtype' arguments and returns -1 if the + * first is less then the second, 0 if both are equal or 1 if the + * first is greater then the second. + * lower_bound : Smallest value of the given range. + * upper_bound : Highest value of the given range. + * from_index : First index from the array to compare (inclusive). + * to_index : Last index from the array to compare (inclusive). + * + * This macro can be used for any data type. Both bounds are inclusive. + */ +#define cmc_assert_array_within_any(dtype, array, comparator, lower_bound, upper_bound, from_index, to_index) \ + do \ + { \ + const char *str__ = #array; \ + dtype *arr__ = array; \ + dtype lower_bound___ = lower_bound; \ + dtype upper_bound___ = upper_bound; \ + size_t from__ = from_index; \ + size_t to__ = to_index; \ + int (*cmp__)(dtype, dtype) = comparator; \ + \ + for (size_t i__ = from__; i__ <= to__; i__++) \ + { \ + if (cmp__(arr__[i__], lower_bound___) < 0 || cmp__(arr__[i__], upper_bound___) > 0) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Array value not within bounds at index %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str__, i__); \ + \ + break; \ + } \ + } \ + \ + } while (0) + +/** + * Assert that each element in the array are within bounds. + * + * dtype : The type of the array. + * array : Array to be checked if its elements are outside of a given range + * comparator : A function that has two 'dtype' arguments and returns -1 if the + * first is less then the second, 0 if both are equal or 1 if the + * first is greater then the second. + * lower_bound : Smallest value of the given range. + * upper_bound : Highest value of the given range. + * from_index : First index from the array to compare (inclusive). + * to_index : Last index from the array to compare (inclusive). + * + * This macro can be used for any data type. Both bounds are inclusive. + */ +#define cmc_assert_array_outside_any(dtype, array, comparator, lower_bound, upper_bound, from_index, to_index) \ + do \ + { \ + const char *str__ = #array; \ + dtype *arr__ = array; \ + dtype lower_bound___ = lower_bound; \ + dtype upper_bound___ = upper_bound; \ + size_t from__ = from_index; \ + size_t to__ = to_index; \ + int (*cmp__)(dtype, dtype) = comparator; \ + \ + for (size_t i__ = from__; i__ <= to__; i__++) \ + { \ + if (cmp__(arr__[i__], lower_bound___) >= 0 && cmp__(arr__[i__], upper_bound___) <= 0) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Array value not outside bounds at index %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str__, i__); \ + \ + break; \ + } \ + } \ + \ + } while (0) + +/** + * Assert that the array is sorted. + * + * dtype : The type of the array. + * array : Array to be checked if it is sorted. * comparator : A function that has two 'dtype' arguments and returns -1 if the * first is less then the second, 0 if both are equal or 1 if the * first is greater then the second. - * from_index : First index from the array to compare (inclusive) - * to_index : Last index from the array to compare (inclusive) + * from_index : First index from the array to compare (inclusive). + * to_index : Last index from the array to compare (inclusive). * * This macro can be used for any data type. */ -#define cmc_assert_sorted(dtype, array, comparator, from_index, to_index) \ +#define cmc_assert_array_sorted_any(dtype, array, comparator, from_index, to_index) \ do \ { \ - const char *str = #array; \ + const char *str__ = #array; \ dtype *arr__ = array; \ size_t from__ = from_index; \ size_t to__ = to_index; \ @@ -191,7 +327,7 @@ static bool cmc_assert_state = true; \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not sorted when comparing indexes %" PRIuMAX " and %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, iprev__, i__); \ + __FILE__, __func__, __LINE__, str__, iprev__, i__); \ \ break; \ } \ @@ -201,20 +337,26 @@ static bool cmc_assert_state = true; \ } while (0) +/** --------------------------------------------------------------------------- + * + * Equals + * + * ------------------------------------------------------------------------ **/ + #define cmc_assert_equals_int8_t(expected, actual) \ do \ { \ const char *str = #actual; \ - int8_t expected_ = (expected); \ - int8_t actual_ = (actual); \ + int8_t expected__ = (expected); \ + int8_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRId8 " Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -223,16 +365,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int16_t expected_ = (expected); \ - int16_t actual_ = (actual); \ + int16_t expected__ = (expected); \ + int16_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRId16 " Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -241,16 +383,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int32_t expected_ = (expected); \ - int32_t actual_ = (actual); \ + int32_t expected__ = (expected); \ + int32_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRId32 " Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -259,16 +401,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int64_t expected_ = (expected); \ - int64_t actual_ = (actual); \ + int64_t expected__ = (expected); \ + int64_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRId64 " Actual: %" PRId64 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -277,16 +419,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint8_t expected_ = (expected); \ - uint8_t actual_ = (actual); \ + uint8_t expected__ = (expected); \ + uint8_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIu8 " Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -295,16 +437,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint16_t expected_ = (expected); \ - uint16_t actual_ = (actual); \ + uint16_t expected__ = (expected); \ + uint16_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIu16 " Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -313,16 +455,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint32_t expected_ = (expected); \ - uint32_t actual_ = (actual); \ + uint32_t expected__ = (expected); \ + uint32_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIu32 " Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -331,16 +473,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint64_t expected_ = (expected); \ - uint64_t actual_ = (actual); \ + uint64_t expected__ = (expected); \ + uint64_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIu64 " Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -349,16 +491,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - intmax_t expected_ = (expected); \ - intmax_t actual_ = (actual); \ + intmax_t expected__ = (expected); \ + intmax_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIdMAX " Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -367,16 +509,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uintmax_t expected_ = (expected); \ - uintmax_t actual_ = (actual); \ + uintmax_t expected__ = (expected); \ + uintmax_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -385,16 +527,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - size_t expected_ = (expected); \ - size_t actual_ = (actual); \ + size_t expected__ = (expected); \ + size_t actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -403,16 +545,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - float expected_ = (expected); \ - float actual_ = (actual); \ + float expected__ = (expected); \ + float actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %f Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -421,16 +563,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - double expected_ = (expected); \ - double actual_ = (actual); \ + double expected__ = (expected); \ + double actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %lf Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -439,16 +581,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - void *expected_ = (expected); \ - void *actual_ = (actual); \ + void *expected__ = (expected); \ + void *actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %p Actual: %p\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) @@ -457,34 +599,40 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - bool expected_ = (expected); \ - bool actual_ = (actual); \ + bool expected__ = (expected); \ + bool actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ != actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected: %d Actual: %d\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) +/** --------------------------------------------------------------------------- + * + * Not equals + * + * ------------------------------------------------------------------------ **/ + #define cmc_assert_not_equals_int8_t(not_expected, actual) \ do \ { \ const char *str = #actual; \ - int8_t not_expected_ = (not_expected); \ - int8_t actual_ = (actual); \ + int8_t not_expected__ = (not_expected); \ + int8_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRId8 " Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -493,16 +641,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int16_t not_expected_ = (not_expected); \ - int16_t actual_ = (actual); \ + int16_t not_expected__ = (not_expected); \ + int16_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRId16 " Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -511,16 +659,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int32_t not_expected_ = (not_expected); \ - int32_t actual_ = (actual); \ + int32_t not_expected__ = (not_expected); \ + int32_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRId32 " Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -529,16 +677,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int64_t not_expected_ = (not_expected); \ - int64_t actual_ = (actual); \ + int64_t not_expected__ = (not_expected); \ + int64_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRId64 " Actual: %" PRId64 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -547,16 +695,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint8_t not_expected_ = (not_expected); \ - uint8_t actual_ = (actual); \ + uint8_t not_expected__ = (not_expected); \ + uint8_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIu8 " Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -565,16 +713,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint16_t not_expected_ = (not_expected); \ - uint16_t actual_ = (actual); \ + uint16_t not_expected__ = (not_expected); \ + uint16_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIu16 " Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -583,16 +731,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint32_t not_expected_ = (not_expected); \ - uint32_t actual_ = (actual); \ + uint32_t not_expected__ = (not_expected); \ + uint32_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIu32 " Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -601,16 +749,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint64_t not_expected_ = (not_expected); \ - uint64_t actual_ = (actual); \ + uint64_t not_expected__ = (not_expected); \ + uint64_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIu64 " Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -619,16 +767,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - intmax_t not_expected_ = (not_expected); \ - intmax_t actual_ = (actual); \ + intmax_t not_expected__ = (not_expected); \ + intmax_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIdMAX " Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -637,16 +785,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uintmax_t not_expected_ = (not_expected); \ - uintmax_t actual_ = (actual); \ + uintmax_t not_expected__ = (not_expected); \ + uintmax_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -655,16 +803,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - size_t not_expected_ = (not_expected); \ - size_t actual_ = (actual); \ + size_t not_expected__ = (not_expected); \ + size_t actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -673,16 +821,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - float not_expected_ = (not_expected); \ - float actual_ = (actual); \ + float not_expected__ = (not_expected); \ + float actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %f Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -691,16 +839,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - double not_expected_ = (not_expected); \ - double actual_ = (actual); \ + double not_expected__ = (not_expected); \ + double actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %lf Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -709,16 +857,16 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - void *not_expected_ = (not_expected); \ - void *actual_ = (actual); \ + void *not_expected__ = (not_expected); \ + void *actual__ = (actual); \ \ - if ((not_expected_) == (actual_)) \ + if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %p Actual: %p\n", \ - __FILE__, __func__, __LINE__, str, not_expected_, actual_); \ + __FILE__, __func__, __LINE__, str, not_expected__, actual__); \ } \ \ } while (0) @@ -727,971 +875,1001 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - bool expected_ = (expected); \ - bool actual_ = (actual); \ + bool expected__ = (expected); \ + bool actual__ = (actual); \ \ - if ((expected_) != (actual_)) \ + if (expected__ == actual__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected: %d Actual: %d\n", \ - __FILE__, __func__, __LINE__, str, expected_, actual_); \ + __FILE__, __func__, __LINE__, str, expected__, actual__); \ } \ \ } while (0) -#define cmc_assert_greater_int8_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int8_t boundary_ = (boundary); \ - int8_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRId8 " Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +/** --------------------------------------------------------------------------- + * + * Greater + * + * ------------------------------------------------------------------------ **/ + +#define cmc_assert_greater_int8_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int8_t boundary__ = (boundary); \ + int8_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRId8 " Actual: %" PRId8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_int16_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int16_t boundary_ = (boundary); \ - int16_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRId16 " Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_int16_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int16_t boundary__ = (boundary); \ + int16_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRId16 " Actual: %" PRId16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_int32_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int32_t boundary_ = (boundary); \ - int32_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRId32 " Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_int32_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int32_t boundary__ = (boundary); \ + int32_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRId32 " Actual: %" PRId32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_int64_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int64_t boundary_ = (boundary); \ - int64_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRId64 " Actual: %" PRId64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_int64_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int64_t boundary__ = (boundary); \ + int64_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRId64 " Actual: %" PRId64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_uint8_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint8_t boundary_ = (boundary); \ - uint8_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIu8 " Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_uint8_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint8_t boundary__ = (boundary); \ + uint8_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIu8 " Actual: %" PRIu8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_uint16_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint16_t boundary_ = (boundary); \ - uint16_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIu16 " Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_uint16_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint16_t boundary__ = (boundary); \ + uint16_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIu16 " Actual: %" PRIu16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_uint32_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint32_t boundary_ = (boundary); \ - uint32_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIu32 " Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_uint32_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint32_t boundary__ = (boundary); \ + uint32_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIu32 " Actual: %" PRIu32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_uint64_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint64_t boundary_ = (boundary); \ - uint64_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIu64 " Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_uint64_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint64_t boundary__ = (boundary); \ + uint64_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIu64 " Actual: %" PRIu64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_intmax_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - intmax_t boundary_ = (boundary); \ - intmax_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIdMAX " Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_intmax_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + intmax_t boundary__ = (boundary); \ + intmax_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIdMAX " Actual: %" PRIdMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_uintmax_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uintmax_t boundary_ = (boundary); \ - uintmax_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_uintmax_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uintmax_t boundary__ = (boundary); \ + uintmax_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_size_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - size_t boundary_ = (boundary); \ - size_t actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_size_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + size_t boundary__ = (boundary); \ + size_t actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_float(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - float boundary_ = (boundary); \ - float actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %f Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_float(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + float boundary__ = (boundary); \ + float actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %f Actual: %f\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_double(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - double boundary_ = (boundary); \ - double actual_ = (actual); \ - \ - if ((actual_) <= (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (excluded): %lf Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_greater_double(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + double boundary__ = (boundary); \ + double actual__ = (actual); \ + \ + if (actual__ <= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater: %lf Actual: %lf\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_greater_equals_int8_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int8_t boundary_ = (boundary); \ - int8_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRId8 " Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) +/** --------------------------------------------------------------------------- + * + * Greater equals + * + * ------------------------------------------------------------------------ **/ -#define cmc_assert_greater_equals_int16_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int16_t boundary_ = (boundary); \ - int16_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRId16 " Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_int32_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int32_t boundary_ = (boundary); \ - int32_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRId32 " Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_int64_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int64_t boundary_ = (boundary); \ - int64_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRId64 " Actual: %" PRId64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_uint8_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint8_t boundary_ = (boundary); \ - uint8_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIu8 " Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_uint16_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint16_t boundary_ = (boundary); \ - uint16_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIu16 " Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_uint32_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint32_t boundary_ = (boundary); \ - uint32_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIu32 " Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_uint64_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint64_t boundary_ = (boundary); \ - uint64_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIu64 " Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_intmax_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - intmax_t boundary_ = (boundary); \ - intmax_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIdMAX " Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_uintmax_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uintmax_t boundary_ = (boundary); \ - uintmax_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_size_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - size_t boundary_ = (boundary); \ - size_t actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_float(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - float boundary_ = (boundary); \ - float actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %f Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_greater_equals_double(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - double boundary_ = (boundary); \ - double actual_ = (actual); \ - \ - if ((actual_) < (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Greater (included): %lf Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ - } while (0) - -#define cmc_assert_lesser_int8_t(boundary, actual) \ +#define cmc_assert_greater_equals_int8_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - int8_t boundary_ = (boundary); \ - int8_t actual_ = (actual); \ + int8_t boundary__ = (boundary); \ + int8_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRId8 " Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRId8 " Actual: %" PRId8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_int16_t(boundary, actual) \ +#define cmc_assert_greater_equals_int16_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - int16_t boundary_ = (boundary); \ - int16_t actual_ = (actual); \ + int16_t boundary__ = (boundary); \ + int16_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRId16 " Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRId16 " Actual: %" PRId16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_int32_t(boundary, actual) \ +#define cmc_assert_greater_equals_int32_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - int32_t boundary_ = (boundary); \ - int32_t actual_ = (actual); \ + int32_t boundary__ = (boundary); \ + int32_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRId32 " Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRId32 " Actual: %" PRId32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_int64_t(boundary, actual) \ +#define cmc_assert_greater_equals_int64_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - int64_t boundary_ = (boundary); \ - int64_t actual_ = (actual); \ + int64_t boundary__ = (boundary); \ + int64_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRId64 " Actual: %" PRId64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRId64 " Actual: %" PRId64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_uint8_t(boundary, actual) \ +#define cmc_assert_greater_equals_uint8_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - uint8_t boundary_ = (boundary); \ - uint8_t actual_ = (actual); \ + uint8_t boundary__ = (boundary); \ + uint8_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIu8 " Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIu8 " Actual: %" PRIu8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_uint16_t(boundary, actual) \ +#define cmc_assert_greater_equals_uint16_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - uint16_t boundary_ = (boundary); \ - uint16_t actual_ = (actual); \ + uint16_t boundary__ = (boundary); \ + uint16_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIu16 " Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIu16 " Actual: %" PRIu16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_uint32_t(boundary, actual) \ +#define cmc_assert_greater_equals_uint32_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - uint32_t boundary_ = (boundary); \ - uint32_t actual_ = (actual); \ + uint32_t boundary__ = (boundary); \ + uint32_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIu32 " Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIu32 " Actual: %" PRIu32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_uint64_t(boundary, actual) \ +#define cmc_assert_greater_equals_uint64_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - uint64_t boundary_ = (boundary); \ - uint64_t actual_ = (actual); \ + uint64_t boundary__ = (boundary); \ + uint64_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIu64 " Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIu64 " Actual: %" PRIu64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_intmax_t(boundary, actual) \ +#define cmc_assert_greater_equals_intmax_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - intmax_t boundary_ = (boundary); \ - intmax_t actual_ = (actual); \ + intmax_t boundary__ = (boundary); \ + intmax_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIdMAX " Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIdMAX " Actual: %" PRIdMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_uintmax_t(boundary, actual) \ +#define cmc_assert_greater_equals_uintmax_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - uintmax_t boundary_ = (boundary); \ - uintmax_t actual_ = (actual); \ + uintmax_t boundary__ = (boundary); \ + uintmax_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_size_t(boundary, actual) \ +#define cmc_assert_greater_equals_size_t(boundary, actual) \ do \ { \ const char *str = #actual; \ - size_t boundary_ = (boundary); \ - size_t actual_ = (actual); \ + size_t boundary__ = (boundary); \ + size_t actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_float(boundary, actual) \ +#define cmc_assert_greater_equals_float(boundary, actual) \ do \ { \ const char *str = #actual; \ - float boundary_ = (boundary); \ - float actual_ = (actual); \ + float boundary__ = (boundary); \ + float actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %f Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %f Actual: %f\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_double(boundary, actual) \ +#define cmc_assert_greater_equals_double(boundary, actual) \ do \ { \ const char *str = #actual; \ - double boundary_ = (boundary); \ - double actual_ = (actual); \ + double boundary__ = (boundary); \ + double actual__ = (actual); \ \ - if ((actual_) >= (boundary_)) \ + if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (excluded): %lf Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Greater or Equals: %lf Actual: %lf\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ } \ \ } while (0) -#define cmc_assert_lesser_equals_int8_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int8_t boundary_ = (boundary); \ - int8_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRId8 " Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +/** --------------------------------------------------------------------------- + * + * Lesser + * + * ------------------------------------------------------------------------ **/ + +#define cmc_assert_lesser_int8_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int8_t boundary__ = (boundary); \ + int8_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRId8 " Actual: %" PRId8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_int16_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int16_t boundary_ = (boundary); \ - int16_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRId16 " Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_int16_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int16_t boundary__ = (boundary); \ + int16_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRId16 " Actual: %" PRId16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_int32_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int32_t boundary_ = (boundary); \ - int32_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRId32 " Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_int32_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int32_t boundary__ = (boundary); \ + int32_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRId32 " Actual: %" PRId32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_int64_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - int64_t boundary_ = (boundary); \ - int64_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRId64 " Actual: %" PRId64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_int64_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int64_t boundary__ = (boundary); \ + int64_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRId64 " Actual: %" PRId64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_uint8_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint8_t boundary_ = (boundary); \ - uint8_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIu8 " Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_uint8_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint8_t boundary__ = (boundary); \ + uint8_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIu8 " Actual: %" PRIu8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_uint16_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint16_t boundary_ = (boundary); \ - uint16_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIu16 " Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_uint16_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint16_t boundary__ = (boundary); \ + uint16_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIu16 " Actual: %" PRIu16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_uint32_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint32_t boundary_ = (boundary); \ - uint32_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIu32 " Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_uint32_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint32_t boundary__ = (boundary); \ + uint32_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIu32 " Actual: %" PRIu32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_uint64_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uint64_t boundary_ = (boundary); \ - uint64_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIu64 " Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_uint64_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint64_t boundary__ = (boundary); \ + uint64_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIu64 " Actual: %" PRIu64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_intmax_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - intmax_t boundary_ = (boundary); \ - intmax_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIdMAX " Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_intmax_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + intmax_t boundary__ = (boundary); \ + intmax_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIdMAX " Actual: %" PRIdMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_uintmax_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - uintmax_t boundary_ = (boundary); \ - uintmax_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_uintmax_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uintmax_t boundary__ = (boundary); \ + uintmax_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_size_t(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - size_t boundary_ = (boundary); \ - size_t actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %" PRIuMAX " Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_size_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + size_t boundary__ = (boundary); \ + size_t actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_float(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - float boundary_ = (boundary); \ - float actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %f Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_float(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + float boundary__ = (boundary); \ + float actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %f Actual: %f\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) -#define cmc_assert_lesser_equals_double(boundary, actual) \ - do \ - { \ - const char *str = #actual; \ - double boundary_ = (boundary); \ - double actual_ = (actual); \ - \ - if ((actual_) > (boundary_)) \ - { \ - cmc_assert_state = false; \ - \ - fprintf(stderr, \ - "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser (included): %lf Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, boundary_, actual_); \ - } \ - \ +#define cmc_assert_lesser_double(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + double boundary__ = (boundary); \ + double actual__ = (actual); \ + \ + if (actual__ >= boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser: %lf Actual: %lf\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ } while (0) +/** --------------------------------------------------------------------------- + * + * Lesser equals + * + * ------------------------------------------------------------------------ **/ + +#define cmc_assert_lesser_equals_int8_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int8_t boundary__ = (boundary); \ + int8_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRId8 " Actual: %" PRId8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_int16_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int16_t boundary__ = (boundary); \ + int16_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRId16 " Actual: %" PRId16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_int32_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int32_t boundary__ = (boundary); \ + int32_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRId32 " Actual: %" PRId32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_int64_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + int64_t boundary__ = (boundary); \ + int64_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRId64 " Actual: %" PRId64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_uint8_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint8_t boundary__ = (boundary); \ + uint8_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIu8 " Actual: %" PRIu8 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_uint16_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint16_t boundary__ = (boundary); \ + uint16_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIu16 " Actual: %" PRIu16 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_uint32_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint32_t boundary__ = (boundary); \ + uint32_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIu32 " Actual: %" PRIu32 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_uint64_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uint64_t boundary__ = (boundary); \ + uint64_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIu64 " Actual: %" PRIu64 "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_intmax_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + intmax_t boundary__ = (boundary); \ + intmax_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIdMAX " Actual: %" PRIdMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_uintmax_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + uintmax_t boundary__ = (boundary); \ + uintmax_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_size_t(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + size_t boundary__ = (boundary); \ + size_t actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %" PRIuMAX " Actual: %" PRIuMAX "\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_float(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + float boundary__ = (boundary); \ + float actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %f Actual: %f\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +#define cmc_assert_lesser_equals_double(boundary, actual) \ + do \ + { \ + const char *str = #actual; \ + double boundary__ = (boundary); \ + double actual__ = (actual); \ + \ + if (actual__ > boundary__) \ + { \ + cmc_assert_state = false; \ + \ + fprintf(stderr, \ + "Assertion Failed at %s:%s:%u for { %s }: Expected Lesser or Equals: %lf Actual: %lf\n", \ + __FILE__, __func__, __LINE__, str, boundary__, actual__); \ + } \ + \ + } while (0) + +/** --------------------------------------------------------------------------- + * + * In range + * + * ------------------------------------------------------------------------ **/ + #define cmc_assert_in_range_int8_t(lower_bound, upper_bound, actual) \ do \ { \ const char *str = #actual; \ - int8_t lower_bound_ = (lower_bound); \ - int8_t upper_bound_ = (upper_bound); \ - int8_t actual_ = (actual); \ + int8_t lower_bound__ = (lower_bound); \ + int8_t upper_bound__ = (upper_bound); \ + int8_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRId8 ", %" PRId8 "] Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1700,17 +1878,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int16_t lower_bound_ = (lower_bound); \ - int16_t upper_bound_ = (upper_bound); \ - int16_t actual_ = (actual); \ + int16_t lower_bound__ = (lower_bound); \ + int16_t upper_bound__ = (upper_bound); \ + int16_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRId16 ", %" PRId16 "] Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1719,17 +1897,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int32_t lower_bound_ = (lower_bound); \ - int32_t upper_bound_ = (upper_bound); \ - int32_t actual_ = (actual); \ + int32_t lower_bound__ = (lower_bound); \ + int32_t upper_bound__ = (upper_bound); \ + int32_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRId32 ", %" PRId32 "] Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1738,17 +1916,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int64_t lower_bound_ = (lower_bound); \ - int64_t upper_bound_ = (upper_bound); \ - int64_t actual_ = (actual); \ + int64_t lower_bound__ = (lower_bound); \ + int64_t upper_bound__ = (upper_bound); \ + int64_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRId32 ", %" PRId32 "] Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1757,17 +1935,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint8_t lower_bound_ = (lower_bound); \ - uint8_t upper_bound_ = (upper_bound); \ - uint8_t actual_ = (actual); \ + uint8_t lower_bound__ = (lower_bound); \ + uint8_t upper_bound__ = (upper_bound); \ + uint8_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIu8 ", %" PRIu8 "] Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1776,17 +1954,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint16_t lower_bound_ = (lower_bound); \ - uint16_t upper_bound_ = (upper_bound); \ - uint16_t actual_ = (actual); \ + uint16_t lower_bound__ = (lower_bound); \ + uint16_t upper_bound__ = (upper_bound); \ + uint16_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIu16 ", %" PRIu16 "] Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1795,17 +1973,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint32_t lower_bound_ = (lower_bound); \ - uint32_t upper_bound_ = (upper_bound); \ - uint32_t actual_ = (actual); \ + uint32_t lower_bound__ = (lower_bound); \ + uint32_t upper_bound__ = (upper_bound); \ + uint32_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIu32 ", %" PRIu32 "] Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1814,17 +1992,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint64_t lower_bound_ = (lower_bound); \ - uint64_t upper_bound_ = (upper_bound); \ - uint64_t actual_ = (actual); \ + uint64_t lower_bound__ = (lower_bound); \ + uint64_t upper_bound__ = (upper_bound); \ + uint64_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIu64 ", %" PRIu64 "] Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1833,17 +2011,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - intmax_t lower_bound_ = (lower_bound); \ - intmax_t upper_bound_ = (upper_bound); \ - intmax_t actual_ = (actual); \ + intmax_t lower_bound__ = (lower_bound); \ + intmax_t upper_bound__ = (upper_bound); \ + intmax_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIdMAX ", %" PRIdMAX "] Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1852,17 +2030,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uintmax_t lower_bound_ = (lower_bound); \ - uintmax_t upper_bound_ = (upper_bound); \ - uintmax_t actual_ = (actual); \ + uintmax_t lower_bound__ = (lower_bound); \ + uintmax_t upper_bound__ = (upper_bound); \ + uintmax_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIuMAX ", %" PRIuMAX "] Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1871,17 +2049,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - size_t lower_bound_ = (lower_bound); \ - size_t upper_bound_ = (upper_bound); \ - size_t actual_ = (actual); \ + size_t lower_bound__ = (lower_bound); \ + size_t upper_bound__ = (upper_bound); \ + size_t actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%" PRIuMAX ", %" PRIuMAX "] Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1890,17 +2068,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - float lower_bound_ = (lower_bound); \ - float upper_bound_ = (upper_bound); \ - float actual_ = (actual); \ + float lower_bound__ = (lower_bound); \ + float upper_bound__ = (upper_bound); \ + float actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%f, %f] Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1909,36 +2087,42 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - double lower_bound_ = (lower_bound); \ - double upper_bound_ = (upper_bound); \ - double actual_ = (actual); \ + double lower_bound__ = (lower_bound); \ + double upper_bound__ = (upper_bound); \ + double actual__ = (actual); \ \ - if ((actual_) < (lower_bound_) || (actual_) > (upper_bound_)) \ + if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Expected Range: [%lf, %lf] Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) +/** --------------------------------------------------------------------------- + * + * Not in range + * + * ------------------------------------------------------------------------ **/ + #define cmc_assert_not_in_range_int8_t(lower_bound, upper_bound, actual) \ do \ { \ const char *str = #actual; \ - int8_t lower_bound_ = (lower_bound); \ - int8_t upper_bound_ = (upper_bound); \ - int8_t actual_ = (actual); \ + int8_t lower_bound__ = (lower_bound); \ + int8_t upper_bound__ = (upper_bound); \ + int8_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRId8 ", %" PRId8 "] Actual: %" PRId8 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1947,17 +2131,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int16_t lower_bound_ = (lower_bound); \ - int16_t upper_bound_ = (upper_bound); \ - int16_t actual_ = (actual); \ + int16_t lower_bound__ = (lower_bound); \ + int16_t upper_bound__ = (upper_bound); \ + int16_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRId16 ", %" PRId16 "] Actual: %" PRId16 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1966,17 +2150,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int32_t lower_bound_ = (lower_bound); \ - int32_t upper_bound_ = (upper_bound); \ - int32_t actual_ = (actual); \ + int32_t lower_bound__ = (lower_bound); \ + int32_t upper_bound__ = (upper_bound); \ + int32_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRId32 ", %" PRId32 "] Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -1985,17 +2169,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - int64_t lower_bound_ = (lower_bound); \ - int64_t upper_bound_ = (upper_bound); \ - int64_t actual_ = (actual); \ + int64_t lower_bound__ = (lower_bound); \ + int64_t upper_bound__ = (upper_bound); \ + int64_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRId32 ", %" PRId32 "] Actual: %" PRId32 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2004,17 +2188,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint8_t lower_bound_ = (lower_bound); \ - uint8_t upper_bound_ = (upper_bound); \ - uint8_t actual_ = (actual); \ + uint8_t lower_bound__ = (lower_bound); \ + uint8_t upper_bound__ = (upper_bound); \ + uint8_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIu8 ", %" PRIu8 "] Actual: %" PRIu8 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2023,17 +2207,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint16_t lower_bound_ = (lower_bound); \ - uint16_t upper_bound_ = (upper_bound); \ - uint16_t actual_ = (actual); \ + uint16_t lower_bound__ = (lower_bound); \ + uint16_t upper_bound__ = (upper_bound); \ + uint16_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIu16 ", %" PRIu16 "] Actual: %" PRIu16 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2042,17 +2226,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint32_t lower_bound_ = (lower_bound); \ - uint32_t upper_bound_ = (upper_bound); \ - uint32_t actual_ = (actual); \ + uint32_t lower_bound__ = (lower_bound); \ + uint32_t upper_bound__ = (upper_bound); \ + uint32_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIu32 ", %" PRIu32 "] Actual: %" PRIu32 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2061,17 +2245,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uint64_t lower_bound_ = (lower_bound); \ - uint64_t upper_bound_ = (upper_bound); \ - uint64_t actual_ = (actual); \ + uint64_t lower_bound__ = (lower_bound); \ + uint64_t upper_bound__ = (upper_bound); \ + uint64_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIu64 ", %" PRIu64 "] Actual: %" PRIu64 "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2080,17 +2264,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - intmax_t lower_bound_ = (lower_bound); \ - intmax_t upper_bound_ = (upper_bound); \ - intmax_t actual_ = (actual); \ + intmax_t lower_bound__ = (lower_bound); \ + intmax_t upper_bound__ = (upper_bound); \ + intmax_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIdMAX ", %" PRIdMAX "] Actual: %" PRIdMAX "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2099,17 +2283,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - uintmax_t lower_bound_ = (lower_bound); \ - uintmax_t upper_bound_ = (upper_bound); \ - uintmax_t actual_ = (actual); \ + uintmax_t lower_bound__ = (lower_bound); \ + uintmax_t upper_bound__ = (upper_bound); \ + uintmax_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIuMAX ", %" PRIuMAX "] Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2118,17 +2302,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - size_t lower_bound_ = (lower_bound); \ - size_t upper_bound_ = (upper_bound); \ - size_t actual_ = (actual); \ + size_t lower_bound__ = (lower_bound); \ + size_t upper_bound__ = (upper_bound); \ + size_t actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%" PRIuMAX ", %" PRIuMAX "] Actual: %" PRIuMAX "\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2137,17 +2321,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - float lower_bound_ = (lower_bound); \ - float upper_bound_ = (upper_bound); \ - float actual_ = (actual); \ + float lower_bound__ = (lower_bound); \ + float upper_bound__ = (upper_bound); \ + float actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%f, %f] Actual: %f\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0) @@ -2156,17 +2340,17 @@ static bool cmc_assert_state = true; do \ { \ const char *str = #actual; \ - double lower_bound_ = (lower_bound); \ - double upper_bound_ = (upper_bound); \ - double actual_ = (actual); \ + double lower_bound__ = (lower_bound); \ + double upper_bound__ = (upper_bound); \ + double actual__ = (actual); \ \ - if ((actual_) >= (lower_bound_) && (actual_) <= (upper_bound_)) \ + if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ \ fprintf(stderr, \ "Assertion Failed at %s:%s:%u for { %s }: Not Expected Range: [%lf, %lf] Actual: %lf\n", \ - __FILE__, __func__, __LINE__, str, lower_bound_, upper_bound_, actual_); \ + __FILE__, __func__, __LINE__, str, lower_bound__, upper_bound__, actual__); \ } \ \ } while (0)