From 656c0e3b3a2a432544bccdaefb02713f2567d561 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Fri, 17 Apr 2020 16:29:52 -0300 Subject: [PATCH] Added cmc_assert_total, cmc_assert_failed, better-looking unit test and other things Started using functions from futils.h in unit test Renamed unit tests --- Makefile | 2 +- src/utl/assert.h | 241 ++++++++++++++++++++++++++++++++++ src/utl/test.h | 191 +++++++++++++++++++-------- tests/main/Makefile | 13 +- tests/main/main.c | 63 ++++++--- tests/main/unt/bidimap.c | 57 ++++---- tests/main/unt/deque.c | 15 +-- tests/main/unt/hashmap.c | 39 +++--- tests/main/unt/hashset.c | 29 ++-- tests/main/unt/heap.c | 16 +-- tests/main/unt/intervalheap.c | 17 ++- tests/main/unt/linkedlist.c | 14 +- tests/main/unt/list.c | 14 +- tests/main/unt/multimap.c | 31 ++--- tests/main/unt/multiset.c | 15 +-- tests/main/unt/queue.c | 15 +-- tests/main/unt/sortedlist.c | 20 +-- tests/main/unt/stack.c | 15 +-- tests/main/unt/treemap.c | 31 ++--- tests/main/unt/treeset.c | 15 +-- tests/main/unt/utl.c | 44 +------ 21 files changed, 592 insertions(+), 305 deletions(-) diff --git a/Makefile b/Makefile index 1127742..64ac000 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,6 @@ utl: FORCE clang-format --style=file -i ./src/utl/*.h tests: FORCE - clang-format --style=file -i ./tests/main/unt/*.c ./tests/*.c + clang-format --style=file -i ./tests/main/unt/*.c ./tests/main/main.c ./tests/*.c FORCE: diff --git a/src/utl/assert.h b/src/utl/assert.h index 266a69f..9b0f001 100644 --- a/src/utl/assert.h +++ b/src/utl/assert.h @@ -60,6 +60,8 @@ #define CMC_ASSERT_GLUE(dtype, assertion) CMC_ASSERT_GLUE_(dtype, assertion) /** + * cmc_assert_state + * * This is a global variable that can be used to test if all assertions passed. * If a single assertion fails, this variable will be set to false. * @@ -68,16 +70,32 @@ */ static bool cmc_assert_state = true; +/** + * cmc_assert_total + * + * Tracks the total calls to any type of assertion. + */ +static uintmax_t cmc_assert_total = 0; + +/** + * cmc_assert_failed + * + * Tracks the total failed assertions. + */ +static uintmax_t cmc_assert_failed = 0; + /** * expression : An expression that is expected to be evaluated to true. */ #define cmc_assert(expression) \ do \ { \ + cmc_assert_total++; \ const char *str = #expression; \ if (!(expression)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf(stderr, "Assertion Failed at %s:%s:%u for { %s }\n", \ __FILE__, __func__, __LINE__, str); \ @@ -186,6 +204,7 @@ static bool cmc_assert_state = true; from_index, to_index) \ do \ { \ + cmc_assert_total++; \ const char *str1__ = #array1; \ const char *str2__ = #array2; \ dtype *arr1__ = array1; \ @@ -199,6 +218,7 @@ static bool cmc_assert_state = true; if (cmp__(arr1__[i__], arr2__[i__]) != 0) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -231,6 +251,7 @@ static bool cmc_assert_state = true; upper_bound, from_index, to_index) \ do \ { \ + cmc_assert_total++; \ const char *str__ = #array; \ dtype *arr__ = array; \ dtype lower_bound___ = lower_bound; \ @@ -245,6 +266,7 @@ static bool cmc_assert_state = true; cmp__(arr__[i__], upper_bound___) > 0) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -277,6 +299,7 @@ static bool cmc_assert_state = true; upper_bound, from_index, to_index) \ do \ { \ + cmc_assert_total++; \ const char *str__ = #array; \ dtype *arr__ = array; \ dtype lower_bound___ = lower_bound; \ @@ -291,6 +314,7 @@ static bool cmc_assert_state = true; cmp__(arr__[i__], upper_bound___) <= 0) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -321,6 +345,7 @@ static bool cmc_assert_state = true; to_index) \ do \ { \ + cmc_assert_total++; \ const char *str__ = #array; \ dtype *arr__ = array; \ size_t from__ = from_index; \ @@ -334,6 +359,7 @@ static bool cmc_assert_state = true; if (cmp__(arr__[iprev__], arr__[i__]) > 0) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -358,6 +384,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_int8_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t expected__ = (expected); \ int8_t actual__ = (actual); \ @@ -365,6 +392,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -378,6 +406,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_int16_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t expected__ = (expected); \ int16_t actual__ = (actual); \ @@ -385,6 +414,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -398,6 +428,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_int32_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t expected__ = (expected); \ int32_t actual__ = (actual); \ @@ -405,6 +436,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -418,6 +450,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_int64_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t expected__ = (expected); \ int64_t actual__ = (actual); \ @@ -425,6 +458,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -438,6 +472,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_uint8_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t expected__ = (expected); \ uint8_t actual__ = (actual); \ @@ -445,6 +480,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -458,6 +494,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_uint16_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t expected__ = (expected); \ uint16_t actual__ = (actual); \ @@ -465,6 +502,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -478,6 +516,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_uint32_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t expected__ = (expected); \ uint32_t actual__ = (actual); \ @@ -485,6 +524,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -498,6 +538,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_uint64_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t expected__ = (expected); \ uint64_t actual__ = (actual); \ @@ -505,6 +546,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -518,6 +560,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_intmax_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t expected__ = (expected); \ intmax_t actual__ = (actual); \ @@ -525,6 +568,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -538,6 +582,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_uintmax_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t expected__ = (expected); \ uintmax_t actual__ = (actual); \ @@ -545,6 +590,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -558,6 +604,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_size_t(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t expected__ = (expected); \ size_t actual__ = (actual); \ @@ -565,6 +612,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -578,6 +626,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_float(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float expected__ = (expected); \ float actual__ = (actual); \ @@ -585,6 +634,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -597,6 +647,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_double(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double expected__ = (expected); \ double actual__ = (actual); \ @@ -604,6 +655,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -616,6 +668,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals_ptr(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ void *expected__ = (expected); \ void *actual__ = (actual); \ @@ -623,6 +676,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -635,6 +689,7 @@ static bool cmc_assert_state = true; #define cmc_assert_equals__Bool(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ bool expected__ = (expected); \ bool actual__ = (actual); \ @@ -642,6 +697,7 @@ static bool cmc_assert_state = true; if (expected__ != actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -660,6 +716,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_int8_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t not_expected__ = (not_expected); \ int8_t actual__ = (actual); \ @@ -667,6 +724,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -680,6 +738,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_int16_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t not_expected__ = (not_expected); \ int16_t actual__ = (actual); \ @@ -687,6 +746,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -700,6 +760,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_int32_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t not_expected__ = (not_expected); \ int32_t actual__ = (actual); \ @@ -707,6 +768,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -720,6 +782,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_int64_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t not_expected__ = (not_expected); \ int64_t actual__ = (actual); \ @@ -727,6 +790,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -740,6 +804,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_uint8_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t not_expected__ = (not_expected); \ uint8_t actual__ = (actual); \ @@ -747,6 +812,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -760,6 +826,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_uint16_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t not_expected__ = (not_expected); \ uint16_t actual__ = (actual); \ @@ -767,6 +834,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -780,6 +848,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_uint32_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t not_expected__ = (not_expected); \ uint32_t actual__ = (actual); \ @@ -787,6 +856,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -800,6 +870,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_uint64_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t not_expected__ = (not_expected); \ uint64_t actual__ = (actual); \ @@ -820,6 +891,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_intmax_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t not_expected__ = (not_expected); \ intmax_t actual__ = (actual); \ @@ -827,6 +899,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -840,6 +913,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_uintmax_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t not_expected__ = (not_expected); \ uintmax_t actual__ = (actual); \ @@ -847,6 +921,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -860,6 +935,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_size_t(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t not_expected__ = (not_expected); \ size_t actual__ = (actual); \ @@ -867,6 +943,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -880,6 +957,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_float(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float not_expected__ = (not_expected); \ float actual__ = (actual); \ @@ -887,6 +965,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -899,6 +978,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_double(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double not_expected__ = (not_expected); \ double actual__ = (actual); \ @@ -906,6 +986,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -918,6 +999,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals_ptr(not_expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ void *not_expected__ = (not_expected); \ void *actual__ = (actual); \ @@ -925,6 +1007,7 @@ static bool cmc_assert_state = true; if (not_expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -937,6 +1020,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_equals__Bool(expected, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ bool expected__ = (expected); \ bool actual__ = (actual); \ @@ -944,6 +1028,7 @@ static bool cmc_assert_state = true; if (expected__ == actual__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -962,6 +1047,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_int8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t boundary__ = (boundary); \ int8_t actual__ = (actual); \ @@ -969,6 +1055,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -982,6 +1069,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_int16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t boundary__ = (boundary); \ int16_t actual__ = (actual); \ @@ -989,6 +1077,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1002,6 +1091,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_int32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t boundary__ = (boundary); \ int32_t actual__ = (actual); \ @@ -1009,6 +1099,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1022,6 +1113,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_int64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t boundary__ = (boundary); \ int64_t actual__ = (actual); \ @@ -1029,6 +1121,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1042,6 +1135,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_uint8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t boundary__ = (boundary); \ uint8_t actual__ = (actual); \ @@ -1049,6 +1143,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1062,6 +1157,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_uint16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t boundary__ = (boundary); \ uint16_t actual__ = (actual); \ @@ -1069,6 +1165,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1082,6 +1179,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_uint32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t boundary__ = (boundary); \ uint32_t actual__ = (actual); \ @@ -1089,6 +1187,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1102,6 +1201,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_uint64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t boundary__ = (boundary); \ uint64_t actual__ = (actual); \ @@ -1109,6 +1209,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1122,6 +1223,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_intmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t boundary__ = (boundary); \ intmax_t actual__ = (actual); \ @@ -1129,6 +1231,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1142,6 +1245,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_uintmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t boundary__ = (boundary); \ uintmax_t actual__ = (actual); \ @@ -1149,6 +1253,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1162,6 +1267,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_size_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t boundary__ = (boundary); \ size_t actual__ = (actual); \ @@ -1169,6 +1275,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1182,6 +1289,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_float(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float boundary__ = (boundary); \ float actual__ = (actual); \ @@ -1189,6 +1297,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1201,6 +1310,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_double(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double boundary__ = (boundary); \ double actual__ = (actual); \ @@ -1208,6 +1318,7 @@ static bool cmc_assert_state = true; if (actual__ <= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1226,6 +1337,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_int8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t boundary__ = (boundary); \ int8_t actual__ = (actual); \ @@ -1233,6 +1345,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1246,6 +1359,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_int16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t boundary__ = (boundary); \ int16_t actual__ = (actual); \ @@ -1253,6 +1367,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1266,6 +1381,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_int32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t boundary__ = (boundary); \ int32_t actual__ = (actual); \ @@ -1273,6 +1389,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1286,6 +1403,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_int64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t boundary__ = (boundary); \ int64_t actual__ = (actual); \ @@ -1293,6 +1411,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1306,6 +1425,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_uint8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t boundary__ = (boundary); \ uint8_t actual__ = (actual); \ @@ -1313,6 +1433,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1326,6 +1447,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_uint16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t boundary__ = (boundary); \ uint16_t actual__ = (actual); \ @@ -1333,6 +1455,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1346,6 +1469,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_uint32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t boundary__ = (boundary); \ uint32_t actual__ = (actual); \ @@ -1353,6 +1477,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1366,6 +1491,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_uint64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t boundary__ = (boundary); \ uint64_t actual__ = (actual); \ @@ -1373,6 +1499,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1386,6 +1513,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_intmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t boundary__ = (boundary); \ intmax_t actual__ = (actual); \ @@ -1393,6 +1521,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1406,6 +1535,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_uintmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t boundary__ = (boundary); \ uintmax_t actual__ = (actual); \ @@ -1413,6 +1543,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1426,6 +1557,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_size_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t boundary__ = (boundary); \ size_t actual__ = (actual); \ @@ -1433,6 +1565,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1446,6 +1579,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_float(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float boundary__ = (boundary); \ float actual__ = (actual); \ @@ -1453,6 +1587,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1465,6 +1600,7 @@ static bool cmc_assert_state = true; #define cmc_assert_greater_equals_double(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double boundary__ = (boundary); \ double actual__ = (actual); \ @@ -1472,6 +1608,7 @@ static bool cmc_assert_state = true; if (actual__ < boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1490,6 +1627,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_int8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t boundary__ = (boundary); \ int8_t actual__ = (actual); \ @@ -1497,6 +1635,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1510,6 +1649,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_int16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t boundary__ = (boundary); \ int16_t actual__ = (actual); \ @@ -1517,6 +1657,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1530,6 +1671,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_int32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t boundary__ = (boundary); \ int32_t actual__ = (actual); \ @@ -1537,6 +1679,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1550,6 +1693,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_int64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t boundary__ = (boundary); \ int64_t actual__ = (actual); \ @@ -1557,6 +1701,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1570,6 +1715,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_uint8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t boundary__ = (boundary); \ uint8_t actual__ = (actual); \ @@ -1577,6 +1723,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1590,6 +1737,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_uint16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t boundary__ = (boundary); \ uint16_t actual__ = (actual); \ @@ -1597,6 +1745,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1610,6 +1759,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_uint32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t boundary__ = (boundary); \ uint32_t actual__ = (actual); \ @@ -1617,6 +1767,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1630,6 +1781,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_uint64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t boundary__ = (boundary); \ uint64_t actual__ = (actual); \ @@ -1637,6 +1789,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1650,6 +1803,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_intmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t boundary__ = (boundary); \ intmax_t actual__ = (actual); \ @@ -1657,6 +1811,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1670,6 +1825,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_uintmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t boundary__ = (boundary); \ uintmax_t actual__ = (actual); \ @@ -1677,6 +1833,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1690,6 +1847,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_size_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t boundary__ = (boundary); \ size_t actual__ = (actual); \ @@ -1697,6 +1855,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1710,6 +1869,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_float(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float boundary__ = (boundary); \ float actual__ = (actual); \ @@ -1717,6 +1877,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1729,6 +1890,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_double(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double boundary__ = (boundary); \ double actual__ = (actual); \ @@ -1736,6 +1898,7 @@ static bool cmc_assert_state = true; if (actual__ >= boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1754,6 +1917,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_int8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t boundary__ = (boundary); \ int8_t actual__ = (actual); \ @@ -1761,6 +1925,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1774,6 +1939,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_int16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t boundary__ = (boundary); \ int16_t actual__ = (actual); \ @@ -1781,6 +1947,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1794,6 +1961,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_int32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t boundary__ = (boundary); \ int32_t actual__ = (actual); \ @@ -1801,6 +1969,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1814,6 +1983,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_int64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t boundary__ = (boundary); \ int64_t actual__ = (actual); \ @@ -1821,6 +1991,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1834,6 +2005,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_uint8_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t boundary__ = (boundary); \ uint8_t actual__ = (actual); \ @@ -1841,6 +2013,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1854,6 +2027,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_uint16_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t boundary__ = (boundary); \ uint16_t actual__ = (actual); \ @@ -1861,6 +2035,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1874,6 +2049,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_uint32_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t boundary__ = (boundary); \ uint32_t actual__ = (actual); \ @@ -1881,6 +2057,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1894,6 +2071,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_uint64_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t boundary__ = (boundary); \ uint64_t actual__ = (actual); \ @@ -1901,6 +2079,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1914,6 +2093,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_intmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t boundary__ = (boundary); \ intmax_t actual__ = (actual); \ @@ -1921,6 +2101,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1934,6 +2115,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_uintmax_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t boundary__ = (boundary); \ uintmax_t actual__ = (actual); \ @@ -1941,6 +2123,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1954,6 +2137,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_size_t(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t boundary__ = (boundary); \ size_t actual__ = (actual); \ @@ -1961,6 +2145,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1974,6 +2159,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_float(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float boundary__ = (boundary); \ float actual__ = (actual); \ @@ -1981,6 +2167,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -1993,6 +2180,7 @@ static bool cmc_assert_state = true; #define cmc_assert_lesser_equals_double(boundary, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double boundary__ = (boundary); \ double actual__ = (actual); \ @@ -2000,6 +2188,7 @@ static bool cmc_assert_state = true; if (actual__ > boundary__) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2018,6 +2207,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_int8_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t lower_bound__ = (lower_bound); \ int8_t upper_bound__ = (upper_bound); \ @@ -2026,6 +2216,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2040,6 +2231,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_int16_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t lower_bound__ = (lower_bound); \ int16_t upper_bound__ = (upper_bound); \ @@ -2048,6 +2240,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2062,6 +2255,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_int32_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t lower_bound__ = (lower_bound); \ int32_t upper_bound__ = (upper_bound); \ @@ -2070,6 +2264,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2084,6 +2279,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_int64_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t lower_bound__ = (lower_bound); \ int64_t upper_bound__ = (upper_bound); \ @@ -2092,6 +2288,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2106,6 +2303,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_uint8_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t lower_bound__ = (lower_bound); \ uint8_t upper_bound__ = (upper_bound); \ @@ -2114,6 +2312,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2128,6 +2327,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_uint16_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t lower_bound__ = (lower_bound); \ uint16_t upper_bound__ = (upper_bound); \ @@ -2136,6 +2336,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2150,6 +2351,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_uint32_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t lower_bound__ = (lower_bound); \ uint32_t upper_bound__ = (upper_bound); \ @@ -2158,6 +2360,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2172,6 +2375,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_uint64_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t lower_bound__ = (lower_bound); \ uint64_t upper_bound__ = (upper_bound); \ @@ -2180,6 +2384,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2194,6 +2399,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_intmax_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t lower_bound__ = (lower_bound); \ intmax_t upper_bound__ = (upper_bound); \ @@ -2202,6 +2408,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2216,6 +2423,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_uintmax_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t lower_bound__ = (lower_bound); \ uintmax_t upper_bound__ = (upper_bound); \ @@ -2224,6 +2432,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2238,6 +2447,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_size_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t lower_bound__ = (lower_bound); \ size_t upper_bound__ = (upper_bound); \ @@ -2246,6 +2456,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2260,6 +2471,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_float(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float lower_bound__ = (lower_bound); \ float upper_bound__ = (upper_bound); \ @@ -2268,6 +2480,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2281,6 +2494,7 @@ static bool cmc_assert_state = true; #define cmc_assert_in_range_double(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double lower_bound__ = (lower_bound); \ double upper_bound__ = (upper_bound); \ @@ -2289,6 +2503,7 @@ static bool cmc_assert_state = true; if ((actual__) < (lower_bound__) || (actual__) > (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2308,6 +2523,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_int8_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int8_t lower_bound__ = (lower_bound); \ int8_t upper_bound__ = (upper_bound); \ @@ -2316,6 +2532,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2330,6 +2547,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_int16_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int16_t lower_bound__ = (lower_bound); \ int16_t upper_bound__ = (upper_bound); \ @@ -2338,6 +2556,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2352,6 +2571,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_int32_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int32_t lower_bound__ = (lower_bound); \ int32_t upper_bound__ = (upper_bound); \ @@ -2360,6 +2580,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2374,6 +2595,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_int64_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ int64_t lower_bound__ = (lower_bound); \ int64_t upper_bound__ = (upper_bound); \ @@ -2382,6 +2604,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2396,6 +2619,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_uint8_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint8_t lower_bound__ = (lower_bound); \ uint8_t upper_bound__ = (upper_bound); \ @@ -2404,6 +2628,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2418,6 +2643,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_uint16_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint16_t lower_bound__ = (lower_bound); \ uint16_t upper_bound__ = (upper_bound); \ @@ -2426,6 +2652,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2440,6 +2667,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_uint32_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint32_t lower_bound__ = (lower_bound); \ uint32_t upper_bound__ = (upper_bound); \ @@ -2448,6 +2676,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2462,6 +2691,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_uint64_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uint64_t lower_bound__ = (lower_bound); \ uint64_t upper_bound__ = (upper_bound); \ @@ -2470,6 +2700,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2484,6 +2715,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_intmax_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ intmax_t lower_bound__ = (lower_bound); \ intmax_t upper_bound__ = (upper_bound); \ @@ -2492,6 +2724,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2506,6 +2739,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_uintmax_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ uintmax_t lower_bound__ = (lower_bound); \ uintmax_t upper_bound__ = (upper_bound); \ @@ -2514,6 +2748,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2528,6 +2763,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_size_t(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ size_t lower_bound__ = (lower_bound); \ size_t upper_bound__ = (upper_bound); \ @@ -2536,6 +2772,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2550,6 +2787,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_float(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ float lower_bound__ = (lower_bound); \ float upper_bound__ = (upper_bound); \ @@ -2558,6 +2796,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ @@ -2571,6 +2810,7 @@ static bool cmc_assert_state = true; #define cmc_assert_not_in_range_double(lower_bound, upper_bound, actual) \ do \ { \ + cmc_assert_total++; \ const char *str = #actual; \ double lower_bound__ = (lower_bound); \ double upper_bound__ = (upper_bound); \ @@ -2579,6 +2819,7 @@ static bool cmc_assert_state = true; if ((actual__) >= (lower_bound__) && (actual__) <= (upper_bound__)) \ { \ cmc_assert_state = false; \ + cmc_assert_failed++; \ \ fprintf( \ stderr, \ diff --git a/src/utl/test.h b/src/utl/test.h index 7b7f51d..8d14dc9 100644 --- a/src/utl/test.h +++ b/src/utl/test.h @@ -45,83 +45,162 @@ #include "assert.h" #include "timer.h" -#ifdef CMC_TEST_COLOR -static const char *cmc_test_color[] = { "\x1b[32m", "\x1b[31m", "\x1b[35m" }; -#endif - struct cmc_test_info { uintmax_t total; uintmax_t passed; uintmax_t failed; + uintmax_t assert_total; + uintmax_t assert_failed; bool aborted; bool verbose; }; +static inline const char *cmc_test_color(int i) +{ +#ifdef CMC_TEST_COLOR + // 0 - Default, all off + // 1 - Failed (red) + // 2 - Passed (green) + // 3 - Box (gray) + // 4 - Name (cyan) + // 5 - Total (yellow) + static const char *cmc_test_colors[] = { + "\x1b[0m", "\x1b[31m", "\x1b[32m", "\x1b[90m", "\x1b[36m", "\x1b[33m" + }; + return cmc_test_colors[i]; +#else + return ""; +#endif +} + /* Logging function */ static void cmc_test_log(const char *unit_name, const char *current_test, bool aborted, bool passed) { if (aborted) { -#ifdef CMC_TEST_COLOR - printf("UNIT_TEST %s %sABORTED\x1b[0m AT %s\n", unit_name, - cmc_test_color[2], current_test); -#else - printf("UNIT_TEST %s ABORTED at %s\n", unit_name, current_test); -#endif + printf(" X UNIT TEST"); + printf("%s", cmc_test_color(4)); + printf(" %s ", unit_name); + printf("%sABORTED%s", cmc_test_color(5), cmc_test_color(0)); + printf(" at %s\n", current_test); } else { -#ifdef CMC_TEST_COLOR - printf("Test from \x1b[33m%s\x1b[0m %s%7s\x1b[0m %s\n", unit_name, - passed ? cmc_test_color[0] : cmc_test_color[1], - passed ? "PASSED" : "FAILED", current_test); -#else - printf("Test from %s %7s %s\n", unit_name, passed ? "PASSED" : "FAILED", - current_test); -#endif + printf("%s", passed ? cmc_test_color(2) : cmc_test_color(1)); + printf(" |"); + printf("%s", cmc_test_color(0)); + printf(" %s", current_test); + size_t str_len = strlen(current_test); + if (str_len < 53) + { + printf(cmc_test_color(3)); + for (size_t i = 0; i < 53 - str_len; i++) + putchar('.'); + } + printf("%s", passed ? cmc_test_color(2) : cmc_test_color(1)); + printf("%s", passed ? "PASSED" : "FAILED"); + printf("%s\n", cmc_test_color(0)); } } -#define CMC_CREATE_UNIT(UNAME, VERBOSE, BODY) \ - uintmax_t UNAME(void) \ - { \ - const char *unit_name = #UNAME; \ - const char *current_test = NULL; \ - \ - struct cmc_test_info tinfo = { 0 }; \ - struct cmc_timer timer = { 0 }; \ - \ - tinfo.verbose = VERBOSE; \ - \ - /* Tests */ \ - cmc_timer_start(timer); \ - \ - BODY; \ - \ - cmc_timer_stop(timer); \ - \ - unittest_abort: \ - if (tinfo.aborted) \ - { \ - cmc_test_log(unit_name, current_test, true, false); \ - } \ - \ - printf("+--------------------------------------------------+\n"); \ - printf("| Unit Test Report : %-30s|\n", unit_name); \ - printf("| TOTAL : %10" PRIuMAX " |\n", \ - tinfo.total); \ - printf("| PASSED : %10" PRIuMAX " |\n", \ - tinfo.passed); \ - printf("| FAILED : %10" PRIuMAX " |\n", \ - tinfo.failed); \ - printf("| |\n"); \ - printf("| Total Unit Test Runtime : %9.0f milliseconds |\n", \ - timer.result); \ - printf("+--------------------------------------------------+\n"); \ - \ - return tinfo.failed; \ +#define CMC_CREATE_UNIT(UNAME, VERBOSE, BODY) \ + uintmax_t UNAME(void) \ + { \ + const char *unit_name = #UNAME; \ + const char *current_test = NULL; \ + \ + struct cmc_test_info tinfo = { 0 }; \ + struct cmc_timer timer = { 0 }; \ + \ + tinfo.verbose = VERBOSE; \ + tinfo.assert_total = cmc_assert_total; \ + tinfo.assert_failed = cmc_assert_failed; \ + \ + /* Tests */ \ + cmc_timer_start(timer); \ + \ + printf(cmc_test_color(3)); \ + printf( \ + " +---------------------------------------------------------------+\n"); \ + printf(" | "); \ + printf(cmc_test_color(0)); \ + printf("Unit "); \ + printf(cmc_test_color(4)); \ + printf("%-56s", unit_name); \ + printf(cmc_test_color(3)); \ + printf( \ + " |\n +---------------------------------------------------------------+"); \ + printf("%s\n", cmc_test_color(0)); \ + \ + BODY; \ + \ + cmc_timer_stop(timer); \ + \ + tinfo.assert_total = cmc_assert_total - tinfo.assert_total; \ + tinfo.assert_failed = cmc_assert_failed - tinfo.assert_failed; \ + \ + unittest_abort: \ + if (tinfo.aborted) \ + { \ + cmc_test_log(unit_name, current_test, true, false); \ + } \ + \ + printf(cmc_test_color(3)); \ + printf( \ + " +---------------------------------------------------------------+\n | "); \ + printf(cmc_test_color(0)); \ + printf("Summary : "); \ + printf(cmc_test_color(4)); \ + printf("%-52s", unit_name); \ + printf("%s|\n", cmc_test_color(3)); \ + printf( \ + " +---------++----------------+-----------------+-----------------+\n | "); \ + printf(cmc_test_color(0)); \ + printf("Tests "); \ + printf(cmc_test_color(3)); \ + printf("||"); \ + printf(cmc_test_color(5)); \ + printf(" Total %8" PRIuMAX "", tinfo.total); \ + printf(cmc_test_color(3)); \ + printf(" | "); \ + printf(cmc_test_color(2)); \ + printf("Passed %8" PRIuMAX "", tinfo.passed); \ + printf(cmc_test_color(3)); \ + printf(" | "); \ + printf(cmc_test_color(1)); \ + printf("Failed %8" PRIuMAX "", tinfo.failed); \ + printf(cmc_test_color(3)); \ + printf(" |\n | "); \ + printf(cmc_test_color(0)); \ + printf("Asserts "); \ + printf(cmc_test_color(3)); \ + printf("||"); \ + printf(cmc_test_color(5)); \ + printf(" Total %8" PRIuMAX "", tinfo.assert_total); \ + printf(cmc_test_color(3)); \ + printf(" | "); \ + printf(cmc_test_color(2)); \ + printf("Passed %8" PRIuMAX "", \ + tinfo.assert_total - tinfo.assert_failed); \ + printf(cmc_test_color(3)); \ + printf(" | "); \ + printf(cmc_test_color(1)); \ + printf("Failed %8" PRIuMAX "", tinfo.assert_failed); \ + printf(cmc_test_color(3)); \ + printf(" |\n"); \ + printf( \ + " +---------++----------------+-----------------+-----------------+\n | "); \ + printf(cmc_test_color(0)); \ + printf("Total Runtime : %32.0f milliseconds", timer.result); \ + printf(" %s|\n", cmc_test_color(3)); \ + printf( \ + " +---------------------------------------------------------------+\n"); \ + printf(cmc_test_color(0)); \ + printf("\n\n"); \ + \ + return tinfo.failed; \ } #define CMC_CREATE_TEST(TNAME, BODY) \ diff --git a/tests/main/Makefile b/tests/main/Makefile index e34be39..73df4e5 100644 --- a/tests/main/Makefile +++ b/tests/main/Makefile @@ -1,27 +1,32 @@ CC = gcc CFLAGS = -std=c11 -Wall -Wextra -CFLAGS += -Wno-unused -Wno-missing-braces -DCMC_TEST_COLOR +CFLAGS += -Wno-unused -Wno-missing-braces CVFLAGS = --coverage -O0 INCLUDE = ../../src/ main: FORCE - $(CC) main.c -o main.exe $(CFLAGS) $(CVFLAGS) -I $(INCLUDE) + $(CC) main.c -o main.exe $(CFLAGS) $(CVFLAGS) -I $(INCLUDE) -DCMC_TEST_COLOR ./main.exe gcov ./main.c dev: FORCE - $(CC) main.c -o main.exe $(CFLAGS) $(CVFLAGS) -I $(INCLUDE) + $(CC) main.c -o main.exe $(CFLAGS) $(CVFLAGS) -I $(INCLUDE) -DCMC_TEST_COLOR ./main.exe gcov ./main.c -n rm *.gcda *.gcno *.exe windev: FORCE - $(CC) main.c -o main.exe $(CFLAGS) $(CVFLAGS) -I $(INCLUDE) + $(CC) main.c -o main.exe $(CFLAGS) $(CVFLAGS) -I $(INCLUDE) -DCMC_TEST_COLOR ./main.exe gcov ./main.c -n del *.gcda *.gcno *.exe nocov: FORCE + $(CC) main.c -o main.exe $(CFLAGS) -I $(INCLUDE) -DCMC_TEST_COLOR + ./main.exe + rm *.exe + +bare: FORCE $(CC) main.c -o main.exe $(CFLAGS) -I $(INCLUDE) ./main.exe rm *.exe diff --git a/tests/main/main.c b/tests/main/main.c index cdfd218..d162a69 100644 --- a/tests/main/main.c +++ b/tests/main/main.c @@ -16,35 +16,56 @@ #include "unt/treemap.c" #include "unt/treeset.c" +#define cmc_run(unit, unit_fails, test_fails) \ + do \ + { \ + uintmax_t f = unit(); \ + \ + if (f != 0) \ + unit_fails += 1; \ + \ + test_fails += f; \ + \ + } while (0) + int main(void) { struct cmc_timer timer; cmc_timer_start(timer); - uintmax_t failed = 0; + uintmax_t tests = 0, units = 0, f; - failed += bidimap_test(); - failed += deque_test(); - failed += hashmap_test(); - failed += hashset_test(); - failed += heap_test(); - failed += intervalheap_test(); - failed += linkedlist_test(); - failed += list_test(); - failed += multimap_test(); - failed += multiset_test(); - failed += queue_test(); - failed += sortedlist_test(); - failed += stack_test(); - failed += treemap_test(); - failed += treeset_test(); + cmc_run(BidiMap, units, tests); + cmc_run(Deque, units, tests); + cmc_run(HashMap, units, tests); + cmc_run(HashSet, units, tests); + cmc_run(Heap, units, tests); + cmc_run(IntervalHeap, units, tests); + cmc_run(LinkedList, units, tests); + cmc_run(List, units, tests); + cmc_run(MultiMap, units, tests); + cmc_run(MultiSet, units, tests); + cmc_run(Queue, units, tests); + cmc_run(SortedList, units, tests); + cmc_run(Stack, units, tests); + cmc_run(TreeMap, units, tests); + cmc_run(TreeSet, units, tests); cmc_timer_stop(timer); - printf("+--------------------------------------------------+\n"); - printf("| Total Tests Failed : %14" PRIuMAX " tests |\n", failed); - printf("| Total Running Time : %14.0lf milliseconds |\n", timer.result); - printf("+--------------------------------------------------+\n"); + printf( + " +---------------------------------------------------------------+\n"); + printf( + " | SUMMARY |\n"); + printf( + " +---------------------------------------------------------------+\n"); + printf(" | Total Units Failed : %25" PRIuMAX " units |\n", tests); + printf(" | Total Tests Failed : %25" PRIuMAX " tests |\n", tests); + printf(" | Total Asserts Failed : %25" PRIuMAX " asserts |\n", + cmc_assert_failed); + printf(" | Total Runtime : %25.0lf milliseconds |\n", timer.result); + printf( + " +---------------------------------------------------------------+\n"); - return failed; + return tests; } diff --git a/tests/main/unt/bidimap.c b/tests/main/unt/bidimap.c index 31153cf..c61b6b2 100644 --- a/tests/main/unt/bidimap.c +++ b/tests/main/unt/bidimap.c @@ -5,39 +5,35 @@ #include "../src/bidimap.c" -struct bidimap_fkey *bm_fkey = - &(struct bidimap_fkey){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct bidimap_fkey *bm_fkey = &(struct bidimap_fkey){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -struct bidimap_fval *bm_fval = - &(struct bidimap_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct bidimap_fval *bm_fval = &(struct bidimap_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -struct bidimap_fkey *bm_fkey_counter = - &(struct bidimap_fkey){ .cmp = k_c_cmp, - .cpy = k_c_cpy, - .str = k_c_str, - .free = k_c_free, - .hash = k_c_hash, - .pri = k_c_pri }; +struct bidimap_fkey *bm_fkey_counter = &(struct bidimap_fkey){ .cmp = k_c_cmp, + .cpy = k_c_cpy, + .str = k_c_str, + .free = k_c_free, + .hash = k_c_hash, + .pri = k_c_pri }; -struct bidimap_fval *bm_fval_counter = - &(struct bidimap_fval){ .cmp = v_c_cmp, - .cpy = v_c_cpy, - .str = v_c_str, - .free = v_c_free, - .hash = v_c_hash, - .pri = v_c_pri }; +struct bidimap_fval *bm_fval_counter = &(struct bidimap_fval){ .cmp = v_c_cmp, + .cpy = v_c_cpy, + .str = v_c_str, + .free = v_c_free, + .hash = v_c_hash, + .pri = v_c_pri }; -CMC_CREATE_UNIT(bidimap_test, true, { +CMC_CREATE_UNIT(BidiMap, true, { CMC_CREATE_TEST(new, { struct bidimap *map = bm_new(100, 0.6, bm_fkey, bm_fval); @@ -194,8 +190,7 @@ CMC_CREATE_UNIT(bidimap_test, true, { node.free = free; node.calloc = calloc; - map = - bm_new_custom(100, 0.6, bm_fkey, bm_fval, &node, callbacks); + map = bm_new_custom(100, 0.6, bm_fkey, bm_fval, &node, callbacks); cmc_assert_not_equals(ptr, NULL, map); diff --git a/tests/main/unt/deque.c b/tests/main/unt/deque.c index 794caab..5aef4ef 100644 --- a/tests/main/unt/deque.c +++ b/tests/main/unt/deque.c @@ -5,15 +5,14 @@ #include "../src/deque.c" -struct deque_fval *d_fval = - &(struct deque_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct deque_fval *d_fval = &(struct deque_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(deque_test, true, { +CMC_CREATE_UNIT(Deque, true, { CMC_CREATE_TEST(new, { struct deque *d = d_new(1000000, d_fval); diff --git a/tests/main/unt/hashmap.c b/tests/main/unt/hashmap.c index 13209d7..41fd590 100644 --- a/tests/main/unt/hashmap.c +++ b/tests/main/unt/hashmap.c @@ -5,23 +5,21 @@ #include "../src/hashmap.c" -struct hashmap_fkey *hm_fkey = - &(struct hashmap_fkey){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct hashmap_fkey *hm_fkey = &(struct hashmap_fkey){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -struct hashmap_fval *hm_fval = - &(struct hashmap_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct hashmap_fval *hm_fval = &(struct hashmap_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(hashmap_test, true, { +CMC_CREATE_UNIT(HashMap, true, { CMC_CREATE_TEST(new, { struct hashmap *map = hm_new(943722, 0.6, hm_fkey, hm_fval); @@ -40,8 +38,7 @@ CMC_CREATE_UNIT(hashmap_test, true, { }); CMC_CREATE_TEST(new[capacity = UINT64_MAX], { - struct hashmap *map = - hm_new(UINT64_MAX, 0.99, hm_fkey, hm_fval); + struct hashmap *map = hm_new(UINT64_MAX, 0.99, hm_fkey, hm_fval); cmc_assert_equals(ptr, NULL, map); }); @@ -104,7 +101,7 @@ CMC_CREATE_UNIT(hashmap_test, true, { cmc_assert_equals(size_t, capacity - 1, map->buffer[capacity - 1].key); cmc_assert_equals(size_t, capacity, map->buffer[0].key); - hm_fkey->hash = hash; + hm_fkey->hash = cmc_size_hash; hm_free(map); }); @@ -125,7 +122,7 @@ CMC_CREATE_UNIT(hashmap_test, true, { for (size_t i = 0; i < 200; i++) cmc_assert_equals(size_t, i, map->buffer[i].dist); - hm_fkey->hash = hash; + hm_fkey->hash = cmc_size_hash; hm_free(map); }); @@ -151,7 +148,7 @@ CMC_CREATE_UNIT(hashmap_test, true, { cmc_assert_equals(size_t, 0, map->buffer[capacity - 1].dist); cmc_assert_equals(size_t, 1, map->buffer[0].dist); - hm_fkey->hash = hash; + hm_fkey->hash = cmc_size_hash; hm_free(map); }); @@ -172,7 +169,7 @@ CMC_CREATE_UNIT(hashmap_test, true, { for (size_t i = 0; i < 6; i++) cmc_assert_equals(size_t, i, hm_impl_get_entry(map, i)->dist); - hm_fkey->hash = hash; + hm_fkey->hash = cmc_size_hash; hm_free(map); }); diff --git a/tests/main/unt/hashset.c b/tests/main/unt/hashset.c index 8fd26f2..e8cf4b5 100644 --- a/tests/main/unt/hashset.c +++ b/tests/main/unt/hashset.c @@ -5,15 +5,14 @@ #include "../src/hashset.c" -struct hashset_fval *hs_fval = - &(struct hashset_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct hashset_fval *hs_fval = &(struct hashset_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(hashset_test, true, { +CMC_CREATE_UNIT(HashSet, true, { CMC_CREATE_TEST(new, { struct hashset *set = hs_new(943722, 0.6, hs_fval); @@ -96,7 +95,7 @@ CMC_CREATE_UNIT(hashset_test, true, { set->buffer[capacity - 1].value); cmc_assert_equals(size_t, capacity, set->buffer[0].value); - hs_fval->hash = hash; + hs_fval->hash = cmc_size_hash; hs_free(set); }); @@ -117,7 +116,7 @@ CMC_CREATE_UNIT(hashset_test, true, { for (size_t i = 0; i < 200; i++) cmc_assert_equals(size_t, i, set->buffer[i].dist); - hs_fval->hash = hash; + hs_fval->hash = cmc_size_hash; hs_free(set); }); @@ -143,7 +142,7 @@ CMC_CREATE_UNIT(hashset_test, true, { cmc_assert_equals(size_t, 0, set->buffer[capacity - 1].dist); cmc_assert_equals(size_t, 1, set->buffer[0].dist); - hs_fval->hash = hash; + hs_fval->hash = cmc_size_hash; hs_free(set); }); @@ -164,7 +163,7 @@ CMC_CREATE_UNIT(hashset_test, true, { for (size_t i = 0; i < 6; i++) cmc_assert_equals(size_t, i, hs_impl_get_entry(set, i)->dist); - hs_fval->hash = hash; + hs_fval->hash = cmc_size_hash; hs_free(set); }); @@ -339,8 +338,7 @@ CMC_CREATE_UNIT(hashset_test, true, { }); CMC_CREATE_TEST(full, { - struct hashset *set = - hs_new(cmc_hashtable_primes[0], 0.99999, hs_fval); + struct hashset *set = hs_new(cmc_hashtable_primes[0], 0.99999, hs_fval); cmc_assert_not_equals(ptr, NULL, set); @@ -481,8 +479,7 @@ CMC_CREATE_UNIT(hashset_test, true, { }); CMC_CREATE_TEST(callbacks, { - struct hashset *set = - hs_new_custom(100, 0.6, hs_fval, NULL, callbacks); + struct hashset *set = hs_new_custom(100, 0.6, hs_fval, NULL, callbacks); cmc_assert_not_equals(ptr, NULL, set); diff --git a/tests/main/unt/heap.c b/tests/main/unt/heap.c index b43b750..de219e1 100644 --- a/tests/main/unt/heap.c +++ b/tests/main/unt/heap.c @@ -5,14 +5,14 @@ #include "../src/heap.c" -struct heap_fval *h_fval = &(struct heap_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct heap_fval *h_fval = &(struct heap_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(heap_test, true, { +CMC_CREATE_UNIT(Heap, true, { CMC_CREATE_TEST(new, { struct heap *h = h_new(1000000, cmc_max_heap, h_fval); @@ -136,7 +136,7 @@ CMC_CREATE_UNIT(heap_test, true, { cmc_assert(h_remove(h)); } - cmc_assert_array_sorted_any(size_t, arr, cmp, 0, 99); + cmc_assert_array_sorted_any(size_t, arr, cmc_size_cmp, 0, 99); h_free(h); }); diff --git a/tests/main/unt/intervalheap.c b/tests/main/unt/intervalheap.c index 0d8dd91..81e63c3 100644 --- a/tests/main/unt/intervalheap.c +++ b/tests/main/unt/intervalheap.c @@ -6,14 +6,14 @@ #include "../src/intervalheap.c" struct intervalheap_fval *ih_fval = - &(struct intervalheap_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; + &(struct intervalheap_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(intervalheap_test, true, { +CMC_CREATE_UNIT(IntervalHeap, true, { CMC_CREATE_TEST(new, { struct intervalheap *ih = ih_new(1000000, ih_fval); @@ -260,8 +260,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, { }); CMC_CREATE_TEST(callbacks, { - struct intervalheap *ih = - ih_new_custom(100, ih_fval, NULL, callbacks); + struct intervalheap *ih = ih_new_custom(100, ih_fval, NULL, callbacks); cmc_assert_not_equals(ptr, NULL, ih); diff --git a/tests/main/unt/linkedlist.c b/tests/main/unt/linkedlist.c index aa43f8d..64c2af2 100644 --- a/tests/main/unt/linkedlist.c +++ b/tests/main/unt/linkedlist.c @@ -6,14 +6,14 @@ #include "../src/linkedlist.c" struct linkedlist_fval *ll_fval = - &(struct linkedlist_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; + &(struct linkedlist_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(linkedlist_test, true, { +CMC_CREATE_UNIT(LinkedList, true, { CMC_CREATE_TEST(new, { struct linkedlist *ll = ll_new(ll_fval); diff --git a/tests/main/unt/list.c b/tests/main/unt/list.c index 09e439b..f376526 100644 --- a/tests/main/unt/list.c +++ b/tests/main/unt/list.c @@ -5,14 +5,14 @@ #include "../src/list.c" -struct list_fval *l_fval = &(struct list_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct list_fval *l_fval = &(struct list_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(list_test, true, { +CMC_CREATE_UNIT(List, true, { CMC_CREATE_TEST(new, { struct list *l = l_new(1000000, l_fval); diff --git a/tests/main/unt/multimap.c b/tests/main/unt/multimap.c index 47fc21e..f335832 100644 --- a/tests/main/unt/multimap.c +++ b/tests/main/unt/multimap.c @@ -5,23 +5,21 @@ #include "../src/multimap.c" -struct multimap_fkey *mm_fkey = - &(struct multimap_fkey){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct multimap_fkey *mm_fkey = &(struct multimap_fkey){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -struct multimap_fval *mm_fval = - &(struct multimap_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct multimap_fval *mm_fval = &(struct multimap_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(multimap_test, true, { +CMC_CREATE_UNIT(MultiMap, true, { CMC_CREATE_TEST(new, { struct multimap *map = mm_new(943722, 0.8, mm_fkey, mm_fval); @@ -40,8 +38,7 @@ CMC_CREATE_UNIT(multimap_test, true, { }); CMC_CREATE_TEST(new[capacity = UINT64_MAX], { - struct multimap *map = - mm_new(UINT64_MAX, 0.99, mm_fkey, mm_fval); + struct multimap *map = mm_new(UINT64_MAX, 0.99, mm_fkey, mm_fval); cmc_assert_equals(ptr, NULL, map); }); diff --git a/tests/main/unt/multiset.c b/tests/main/unt/multiset.c index 00e31d9..688a49d 100644 --- a/tests/main/unt/multiset.c +++ b/tests/main/unt/multiset.c @@ -5,15 +5,14 @@ #include "../src/multiset.c" -struct multiset_fval *ms_fval = - &(struct multiset_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct multiset_fval *ms_fval = &(struct multiset_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(multiset_test, true, { +CMC_CREATE_UNIT(MultiSet, true, { CMC_CREATE_TEST(new, { struct multiset *set = ms_new(943722, 0.6, ms_fval); diff --git a/tests/main/unt/queue.c b/tests/main/unt/queue.c index aa968c0..5b83ba9 100644 --- a/tests/main/unt/queue.c +++ b/tests/main/unt/queue.c @@ -5,15 +5,14 @@ #include "../src/queue.c" -struct queue_fval *q_fval = - &(struct queue_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct queue_fval *q_fval = &(struct queue_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(queue_test, true, { +CMC_CREATE_UNIT(Queue, true, { CMC_CREATE_TEST(new, { struct queue *q = q_new(1000000, q_fval); diff --git a/tests/main/unt/sortedlist.c b/tests/main/unt/sortedlist.c index 4a32f09..cf2ddf0 100644 --- a/tests/main/unt/sortedlist.c +++ b/tests/main/unt/sortedlist.c @@ -6,14 +6,14 @@ #include "../src/sortedlist.c" struct sortedlist_fval *sl_fval = - &(struct sortedlist_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; + &(struct sortedlist_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(sortedlist_test, true, { +CMC_CREATE_UNIT(SortedList, true, { CMC_CREATE_TEST(new, { struct sortedlist *sl = sl_new(1000000, sl_fval); @@ -67,7 +67,8 @@ CMC_CREATE_UNIT(sortedlist_test, true, { sl_sort(sl); cmc_assert_equals(size_t, 50, sl_count(sl)); - cmc_assert_array_sorted_any(size_t, sl->buffer, cmp, 0, sl->count - 1); + cmc_assert_array_sorted_any(size_t, sl->buffer, cmc_size_cmp, 0, + sl->count - 1); sl_free(sl); }); @@ -235,8 +236,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, { }); CMC_CREATE_TEST(callbacks, { - struct sortedlist *sl = - sl_new_custom(100, sl_fval, NULL, callbacks); + struct sortedlist *sl = sl_new_custom(100, sl_fval, NULL, callbacks); cmc_assert_not_equals(ptr, NULL, sl); diff --git a/tests/main/unt/stack.c b/tests/main/unt/stack.c index f604bcb..c2e461e 100644 --- a/tests/main/unt/stack.c +++ b/tests/main/unt/stack.c @@ -5,15 +5,14 @@ #include "../src/stack.c" -struct stack_fval *s_fval = - &(struct stack_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct stack_fval *s_fval = &(struct stack_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(stack_test, true, { +CMC_CREATE_UNIT(Stack, true, { CMC_CREATE_TEST(new, { struct stack *s = s_new(1000000, s_fval); diff --git a/tests/main/unt/treemap.c b/tests/main/unt/treemap.c index 313872d..1a9d1f5 100644 --- a/tests/main/unt/treemap.c +++ b/tests/main/unt/treemap.c @@ -5,23 +5,21 @@ #include "../src/treemap.c" -struct treemap_fkey *tm_fkey = - &(struct treemap_fkey){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct treemap_fkey *tm_fkey = &(struct treemap_fkey){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -struct treemap_fval *tm_fval = - &(struct treemap_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct treemap_fval *tm_fval = &(struct treemap_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(treemap_test, true, { +CMC_CREATE_UNIT(TreeMap, true, { CMC_CREATE_TEST(new, { struct treemap *map = tm_new(tm_fkey, tm_fval); @@ -142,8 +140,7 @@ CMC_CREATE_UNIT(treemap_test, true, { }); CMC_CREATE_TEST(callbacks, { - struct treemap *map = - tm_new_custom(tm_fkey, tm_fval, NULL, callbacks); + struct treemap *map = tm_new_custom(tm_fkey, tm_fval, NULL, callbacks); cmc_assert_not_equals(ptr, NULL, map); diff --git a/tests/main/unt/treeset.c b/tests/main/unt/treeset.c index 93a98ed..8650eeb 100644 --- a/tests/main/unt/treeset.c +++ b/tests/main/unt/treeset.c @@ -5,15 +5,14 @@ #include "../src/treeset.c" -struct treeset_fval *ts_fval = - &(struct treeset_fval){ .cmp = cmp, - .cpy = copy, - .str = str, - .free = custom_free, - .hash = hash, - .pri = pri }; +struct treeset_fval *ts_fval = &(struct treeset_fval){ .cmp = cmc_size_cmp, + .cpy = NULL, + .str = cmc_size_str, + .free = NULL, + .hash = cmc_size_hash, + .pri = cmc_size_cmp }; -CMC_CREATE_UNIT(treeset_test, true, { +CMC_CREATE_UNIT(TreeSet, true, { CMC_CREATE_TEST(new, { struct treeset *set = ts_new(ts_fval); diff --git a/tests/main/unt/utl.c b/tests/main/unt/utl.c index 522aec5..0775839 100644 --- a/tests/main/unt/utl.c +++ b/tests/main/unt/utl.c @@ -2,48 +2,12 @@ #ifndef CMC_UNIT_TEST_UTL__ #define CMC_UNIT_TEST_UTL__ -#include #include #include #include -int cmp(size_t a, size_t b) -{ - return (a > b) - (a < b); -} - -size_t copy(size_t a) -{ - return a; -} - -bool str(FILE *fptr, size_t a) -{ - return fprintf(fptr, "%" PRIuMAX " ", a) > 0; -} - -void custom_free(size_t a) -{ - // blank - // Free any resources if necessary -} - -size_t hash(size_t a) -{ - a += ~(a << 15); - a ^= (a >> 10); - a += (a << 3); - a ^= (a >> 6); - a += ~(a << 11); - a ^= (a >> 16); - return a; -} - -int pri(size_t a, size_t b) -{ - // Could contain different logic - return cmp(a, b); -} +#include "cmc/hashmap.h" +#include "utl/futils.h" size_t numhash(size_t a) { @@ -116,7 +80,7 @@ size_t k_c_hash(size_t x) int k_c_pri(size_t a, size_t b) { k_total_pri++; - return cmp(a, b); + return cmc_size_cmp(a, b); } int v_c_cmp(size_t a, size_t b) @@ -154,7 +118,7 @@ size_t v_c_hash(size_t x) int v_c_pri(size_t a, size_t b) { v_total_pri++; - return cmp(a, b); + return cmc_size_cmp(a, b); } // callbacks