libgpac
Documentation of the core library of GPAC
tests.h File Reference
#include <gpac/setup.h>
+ Include dependency graph for tests.h:

Macros

#define unittest(suffix)   void test_##suffix(void)
 
#define assert_true(expr)
 
#define assert_false(expr)   assert_true(!(expr))
 
#define assert_equal_str(str1, str2)   assert_true(!strcmp((str1), (str2)))
 
#define assert_equal_mem(m1, m2, sz)   assert_true(memcmp(m1, m2, sz) == 0)
 
#define assert_not_equal_str(str1, str2)   assert_true(strcmp((str1), (str2)))
 
#define assert_equal(a, b)   assert_true((a) == (b))
 
#define assert_greater(a, b)   assert_true((a) > (b))
 
#define assert_greater_equal(a, b)   assert_true((a) >= (b))
 
#define assert_less(a, b)   assert_true((a) < (b))
 
#define assert_less_equal(a, b)   assert_true((a) <= (b))
 
#define assert_not_null(ptr)   assert_true((ptr) != NULL)
 

Variables

int checks_passed
 
int checks_failed
 
static Bool verbose_ut = GF_FALSE
 
static Bool fatal_ut = GF_TRUE
 

Macro Definition Documentation

◆ unittest

#define unittest (   suffix)    void test_##suffix(void)

◆ assert_true

#define assert_true (   expr)
Value:
do { \
if (expr) { \
if (verbose_ut) printf("Assertion passed: \"%s\", File: \"%s\", Line: %d, Function: \"%s\"\n", #expr, __FILE__, __LINE__, __func__); \
checks_passed++; \
} else { \
printf("Assertion failed: \"%s\", File: \"%s\", Line: %d, Function: \"%s\"\n", #expr, __FILE__, __LINE__, __func__); \
checks_failed++; \
if (fatal_ut) checks_failed|=0x8000000; \
} \
} while (0)
int checks_failed
static Bool fatal_ut
Definition: tests.h:11
static Bool verbose_ut
Definition: tests.h:10

◆ assert_false

#define assert_false (   expr)    assert_true(!(expr))

◆ assert_equal_str

#define assert_equal_str (   str1,
  str2 
)    assert_true(!strcmp((str1), (str2)))

◆ assert_equal_mem

#define assert_equal_mem (   m1,
  m2,
  sz 
)    assert_true(memcmp(m1, m2, sz) == 0)

◆ assert_not_equal_str

#define assert_not_equal_str (   str1,
  str2 
)    assert_true(strcmp((str1), (str2)))

◆ assert_equal

#define assert_equal (   a,
 
)    assert_true((a) == (b))

◆ assert_greater

#define assert_greater (   a,
 
)    assert_true((a) > (b))

◆ assert_greater_equal

#define assert_greater_equal (   a,
 
)    assert_true((a) >= (b))

◆ assert_less

#define assert_less (   a,
 
)    assert_true((a) < (b))

◆ assert_less_equal

#define assert_less_equal (   a,
 
)    assert_true((a) <= (b))

◆ assert_not_null

#define assert_not_null (   ptr)    assert_true((ptr) != NULL)

Variable Documentation

◆ checks_passed

int checks_passed
extern

◆ checks_failed

int checks_failed
extern

◆ verbose_ut

Bool verbose_ut = GF_FALSE
static

◆ fatal_ut

Bool fatal_ut = GF_TRUE
static