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
This commit is contained in:
1 parent
6f1fb7554e
commit
656c0e3b3a
21 files changed
+592
-305
No files matched your search
+42
-21
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user