mirror of
https://github.com/Karaka-Management/cOMS.git
synced 2026-01-18 22:28:40 +00:00
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
/**
|
|
* Karaka
|
|
*
|
|
* @package Utils
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://karaka.app
|
|
*/
|
|
#ifndef UTILS_TEST_UTILS_H
|
|
#define UTILS_TEST_UTILS_H
|
|
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
#define ASSERT_EQUALS(a, b, t1, t2) \
|
|
({ __typeof__ (a) _a = (a); \
|
|
__typeof__ (b) _b = (b); \
|
|
if (_a == _b) { \
|
|
printf("."); \
|
|
} else { \
|
|
printf("F"); \
|
|
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
|
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
|
return 0; } \
|
|
})
|
|
|
|
#define ASSERT_EQUALS__DELTA(a, b, delta, t1, t2) \
|
|
({ __typeof__ (a) _a = (a); \
|
|
__typeof__ (b) _b = (b); \
|
|
if (abs(_a - _b) <= delta) { \
|
|
printf("."); \
|
|
} else { \
|
|
printf("F"); \
|
|
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
|
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
|
return 0; } \
|
|
})
|
|
|
|
#endif |