85#define ANSI_COLOR_RED "\x1b[31m"
86#define ANSI_COLOR_GREEN "\x1b[32m"
87#define ANSI_COLOR_YELLOW "\x1b[33m"
88#define ANSI_COLOR_BLUE "\x1b[34m"
89#define ANSI_COLOR_MAGENTA "\x1b[35m"
90#define ANSI_COLOR_CYAN "\x1b[36m"
91#define ANSI_COLOR_RESET "\x1b[0m"
129int grand_total_failctr;
135int grand_total_testctr;
141int test_functions_skipped;
174#define MAX_BNDLSIZE 1024
179#define COMPARE_BUNDLES(refbndl, testbndl) \
180 memcmp(refbndl, testbndl, 4 + ntohl(*((int32_t *)refbndl)))
183void sighandler(
int signo)
185 if(signo == SIGABRT){
195static char *align(
char *p)
218 memset(buf, 0, 65536);
219 ose_pprintBundle(bundle, buf, 65536);
220 fprintf(stderr,
"\n\r%s>>>>>\n\r%s\n\r%s<<<<<\n\r",
239 char *b = ose_getBundlePtr(bundle);
240 for(int32_t i = start; i < end; i++){
241 fprintf(stderr,
"%d: %c %d\n\r", i,
243 (
unsigned char)b[i]);
252 printf(ANSI_COLOR_GREEN
"%d / %d tests PASSED" ANSI_COLOR_RESET
"\n",
253 testctr - tests_skipped, testctr);
255 printf(ANSI_COLOR_YELLOW
"%d tests SKIPPED" ANSI_COLOR_RESET
"\n",
265 printf(ANSI_COLOR_RED
"...%d of %d tests FAILED" ANSI_COLOR_RESET
"\n",
275 printf(ANSI_COLOR_RED
276 "NO TESTS PERFORMED for this unit"
296 printf(ANSI_COLOR_CYAN
314#define TEST_FUNCTION(pfx, fn) \
317 grand_total_testctr++; \
318 print_startTest(#fn); \
321 print_results(#fn); \
323 grand_total_failctr++; \
337#define SKIP_TEST_FUNCTION(fn) \
338 test_functions_skipped++; \
339 grand_total_testctr++; \
340 printf(ANSI_COLOR_YELLOW \
357#define SKIP_TEST(test, expected_result) \
361 printf(ANSI_COLOR_YELLOW \
362 "\nSKIPPING test %s" \
376 signal(SIGABRT, sighandler);
380 grand_total_testctr = grand_total_failctr = 0;
381 test_functions_skipped = tests_skipped = 0;
397 printf(
"\n**************************************************\n");
398 if(!grand_total_failctr){
399 printf(ANSI_COLOR_GREEN
400 "%d / %d TESTS PASSED"
403 grand_total_testctr - test_functions_skipped,
404 grand_total_testctr);
405 if(test_functions_skipped){
406 printf(ANSI_COLOR_YELLOW
410 test_functions_skipped);
413 printf(ANSI_COLOR_RED
414 "%d / %d TESTS FAILED"
418 grand_total_testctr);
420 printf(
"**************************************************\n");
421 return grand_total_failctr ? 1 : 0;
provides global definitions and types
contains functions that structure an OSC bundle for use with other parts of this library
Rendering a bundle for a human to read.
int verbose
Enable / disable verbosity.
Definition ose_test_common.h:169
static void init(void)
Initialize the testing system.
Definition ose_test_common.h:374
const int32_t ASSERTION_PASSED
The return code for a passed assertion.
Definition ose_test_common.h:109
static void print_failed(const char *const fname)
Print a message indicating that the current test failed.
Definition ose_test_common.h:263
static void pbndl(ose_bundle bundle, const char *const str)
Format and print the contents of a bundle to stderr.
Definition ose_test_common.h:215
static int finalize(void)
Finalize the testing system.
Definition ose_test_common.h:395
static void print_passed(const char *const fname)
Print a message indicating that the current test passed.
Definition ose_test_common.h:250
static void print_startTest(const char *const fname)
Initialize global variables and print a preamble for a test.
Definition ose_test_common.h:292
static void print_results(const char *const fname)
Print the results of the current test.
Definition ose_test_common.h:272
const int32_t ASSERTION_FAILED
The return code for a failed assertion.
Definition ose_test_common.h:102
static void pbytes(ose_bundle bundle, int32_t start, int32_t end)
Print each byte of a bundle on a separate line to stderr.
Definition ose_test_common.h:237
contains basic utilities for reading, writing, and querying an OSC bundle