LibDap-test
/home/blus/DemLabs/libdap/MVL/libdap-test/dap_test.h
Go to the documentation of this file.
1 #pragma once
2 #include <assert.h>
3 #include <stdbool.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <string.h>
7 #include <time.h>
8 
9 #define TEXT_COLOR_RED "\x1B[31m"
10 #define TEXT_COLOR_GRN "\x1B[32m"
11 #define TEXT_COLOR_YEL "\x1B[33m"
12 #define TEXT_COLOR_BLU "\x1B[34m"
13 #define TEXT_COLOR_MAG "\x1B[35m"
14 #define TEXT_COLOR_CYN "\x1B[36m"
15 #define TEXT_COLOR_WHT "\x1B[37m"
16 #define TEXT_COLOR_RESET "\x1B[0m"
17 
18 /* Can be used like debug info during write test*/
22 #define dap_test_msg(...) \
23  printf("\t%s", TEXT_COLOR_WHT); \
24  printf(__VA_ARGS__); \
25  printf("%s\n", TEXT_COLOR_RESET);
26 
27 #define dap_fail(msg) \
28  printf("\t%s%s!%s\n", TEXT_COLOR_RED, msg, TEXT_COLOR_RESET); \
29  exit(-1);
30 
31 /* PIF - print if failed. For checking value in loop, for don't repeat output */
35 #define dap_assert_PIF(expr, msg) \
36  if(expr) {} \
37  else { \
38  printf("\t%s%s FAILED!%s\n", TEXT_COLOR_RED, msg, TEXT_COLOR_RESET); \
39  exit(-1); }
40 
44 #define dap_assert(expr, testname) \
45  if(expr) { \
46  printf("\t%s%s PASS.%s\n", TEXT_COLOR_GRN, testname, TEXT_COLOR_RESET); \
47  } else { \
48  printf("\t%s%s FAILED!%s\n", TEXT_COLOR_RED, testname, TEXT_COLOR_RESET); \
49  exit(-1); }\
50 
51 
54 #define dap_pass_msg(testname) \
55  printf("\t%s%s PASS.%s\n", TEXT_COLOR_GRN, testname, TEXT_COLOR_RESET); \
56 
57 
60 #define dap_print_module_name(module_name) \
61  printf("%s%s passing the tests... %s\n", TEXT_COLOR_CYN, module_name, TEXT_COLOR_RESET);
62 
63 void dap_dump_hex(const void* data, size_t size);
void dap_dump_hex(const void *data, size_t size)
The function displays a dump.
Definition: dap_test.c:22