LibDap-test
Macros | Functions
/home/blus/DemLabs/libdap/MVL/libdap-test/dap_test.h File Reference
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
Include dependency graph for dap_test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TEXT_COLOR_RED   "\x1B[31m"
 
#define TEXT_COLOR_GRN   "\x1B[32m"
 
#define TEXT_COLOR_YEL   "\x1B[33m"
 
#define TEXT_COLOR_BLU   "\x1B[34m"
 
#define TEXT_COLOR_MAG   "\x1B[35m"
 
#define TEXT_COLOR_CYN   "\x1B[36m"
 
#define TEXT_COLOR_WHT   "\x1B[37m"
 
#define TEXT_COLOR_RESET   "\x1B[0m"
 
#define dap_test_msg(...)
 Can be used like debug info during write test. More...
 
#define dap_fail(msg)
 
#define dap_assert_PIF(expr, msg)
 PIF - print if failed. For checking value in loop, for don't repeat output. More...
 
#define dap_assert(expr, testname)
 
#define dap_pass_msg(testname)   printf("\t%s%s PASS.%s\n", TEXT_COLOR_GRN, testname, TEXT_COLOR_RESET); \
 Display the name test. More...
 
#define dap_print_module_name(module_name)   printf("%s%s passing the tests... %s\n", TEXT_COLOR_CYN, module_name, TEXT_COLOR_RESET);
 Display the name of the test module. More...
 

Functions

void dap_dump_hex (const void *data, size_t size)
 The function displays a dump. More...
 

Macro Definition Documentation

#define dap_assert (   expr,
  testname 
)
Value:
if(expr) { \
printf("\t%s%s PASS.%s\n", TEXT_COLOR_GRN, testname, TEXT_COLOR_RESET); \
} else { \
printf("\t%s%s FAILED!%s\n", TEXT_COLOR_RED, testname, TEXT_COLOR_RESET); \
exit(-1); }\
#define TEXT_COLOR_RED
Definition: dap_test.h:9
#define TEXT_COLOR_RESET
Definition: dap_test.h:16
#define TEXT_COLOR_GRN
Definition: dap_test.h:10
#define dap_assert_PIF (   expr,
  msg 
)
Value:
if(expr) {} \
else { \
printf("\t%s%s FAILED!%s\n", TEXT_COLOR_RED, msg, TEXT_COLOR_RESET); \
exit(-1); }
#define TEXT_COLOR_RED
Definition: dap_test.h:9
#define TEXT_COLOR_RESET
Definition: dap_test.h:16

PIF - print if failed. For checking value in loop, for don't repeat output.

#define dap_fail (   msg)
Value:
printf("\t%s%s!%s\n", TEXT_COLOR_RED, msg, TEXT_COLOR_RESET); \
exit(-1);
#define TEXT_COLOR_RED
Definition: dap_test.h:9
#define TEXT_COLOR_RESET
Definition: dap_test.h:16
#define dap_pass_msg (   testname)    printf("\t%s%s PASS.%s\n", TEXT_COLOR_GRN, testname, TEXT_COLOR_RESET); \

Display the name test.

#define dap_print_module_name (   module_name)    printf("%s%s passing the tests... %s\n", TEXT_COLOR_CYN, module_name, TEXT_COLOR_RESET);

Display the name of the test module.

#define dap_test_msg (   ...)
Value:
printf("\t%s", TEXT_COLOR_WHT); \
printf(__VA_ARGS__); \
printf("%s\n", TEXT_COLOR_RESET);
#define TEXT_COLOR_RESET
Definition: dap_test.h:16
#define TEXT_COLOR_WHT
Definition: dap_test.h:15

Can be used like debug info during write test.

#define TEXT_COLOR_BLU   "\x1B[34m"
#define TEXT_COLOR_CYN   "\x1B[36m"
#define TEXT_COLOR_GRN   "\x1B[32m"
#define TEXT_COLOR_MAG   "\x1B[35m"
#define TEXT_COLOR_RED   "\x1B[31m"
#define TEXT_COLOR_RESET   "\x1B[0m"
#define TEXT_COLOR_WHT   "\x1B[37m"
#define TEXT_COLOR_YEL   "\x1B[33m"

Function Documentation

void dap_dump_hex ( const void *  data,
size_t  size 
)

The function displays a dump.

Parameters
[in]dataThe data dump you want to display
[in]sizeThe size of the data whose dump you want to display

The function displays a dump, for example an array, in hex format