44 #define ATTO_VERSION "1.4.0" 
   86 #define ATTO_FLOAT_EQ_ABSTOL (1e-5f) 
   95 #define ATTO_DOUBLE_EQ_ABSTOL (1e-8) 
  108 #define atto_report() \ 
  109     printf("REPORT | File: %s:%d | Test case: %s" \
 
  110            " | Passes: %5zu | Failures: %5zu\n", \
 
  111            __FILE__, __LINE__, __func__,          \
 
  112            atto_counter_assert_passes, atto_counter_assert_failures)
 
  136 #define atto_assert(expression) do {                   \ 
  137     if (!(expression)) {                               \ 
  138         printf("FAIL | File: %s:%d | Test case: %s\n", \
 
  139                __FILE__, __LINE__, __func__);          \
 
  140         atto_counter_assert_failures++;                \
 
  141         atto_at_least_one_fail = 1;                    \
 
  144         atto_counter_assert_passes++;                  \
 
  153 #define atto_true(x) atto_assert(x) 
  167 #define atto_false(x) atto_assert(!(x)) 
  186 #define atto_eq(a, b) atto_assert((a) == (b)) 
  201 #define atto_neq(a, b) atto_assert((a) != (b)) 
  216 #define atto_gt(a, b) atto_assert((a) > (b)) 
  231 #define atto_ge(a, b) atto_assert((a) >= (b)) 
  246 #define atto_lt(a, b) atto_assert((a) < (b)) 
  261 #define atto_le(a, b) atto_assert((a) <= (b)) 
  276 #define atto_fdelta(a, b, delta) atto_assert(fabsf((a) - (b)) <= fabsf(delta)) 
  292 #define atto_fapprox(a, b) atto_fdelta((a), (b), ATTO_FLOAT_EQ_ABSTOL) 
  307 #define atto_ddelta(a, b, delta) \ 
  308     atto_assert(fabs((a) - (b)) <= fabs(delta)) 
  324 #define atto_dapprox(a, b) atto_ddelta((a), (b), ATTO_DOUBLE_EQ_ABSTOL) 
  340 #define atto_nan(value) atto_assert(isnan(value)) 
  357 #define atto_inf(value) atto_assert(isinf(value)) 
  373 #define atto_plusinf(value) atto_assert((isinf(value)) && ((value) > 0)) 
  389 #define atto_minusinf(value) atto_assert((isinf(value)) && ((value) < 0)) 
  406 #define atto_finite(value) atto_assert(isfinite(value)) 
  423 #define atto_notfinite(value) atto_assert(!isfinite(value)) 
  438 #define atto_flag(value, mask) atto_assert(((value) & (mask))) 
  452 #define atto_noflag(value, mask) atto_assert(((value) & (mask)) == 0) 
  468 #define atto_streq(a, b, maxlen) \ 
  469     atto_assert(strncmp((a), (b), (maxlen)) == 0) 
  484 #define atto_memeq(a, b, len) atto_assert(memcmp((a), (b), len) == 0) 
  499 #define atto_memneq(a, b, len) atto_assert(memcmp((a), (b), len) != 0) 
  517 #define atto_zeros(x, len) do { \ 
  518         for (size_t __atto_idx = 0; __atto_idx < (size_t)(len); __atto_idx++) \ 
  519         { atto_eq(((uint8_t*)(x))[__atto_idx], 0); } \ 
  543 #define atto_nzeros(x, len) do { \ 
  544         uint8_t __atto_all_zero = 1; \ 
  545         for (size_t __atto_idx = 0; __atto_idx < (size_t)(len); __atto_idx++) \ 
  546         { if(((uint8_t*)(x))[__atto_idx] != 0) \ 
  547             { __atto_all_zero = 0; break; } \ 
  549         atto_false(__atto_all_zero); \ 
  556 #define atto_fail() atto_assert(0) 
char atto_at_least_one_fail
Boolean indicating if all tests passed successfully (when 0) or not.
 
size_t atto_counter_assert_passes
Counter of all Atto assertion macro calls that passed the check.
 
size_t atto_counter_assert_failures
Counter of all Atto assertion macro calls that failed the check.