MeshLib C++ Docs
Loading...
Searching...
No Matches
TestMacros.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <tgmath.h>

Go to the source code of this file.

Macros

#define TEST_ASSERT(...)
 
#define TEST_ASSERT_INT_EQUAL(val, exp)
 
#define TEST_ASSERT_FLOAT_EQUAL_APPROX(val, exp, eps)
 

Macro Definition Documentation

◆ TEST_ASSERT

#define TEST_ASSERT ( ...)
Value:
if ( !( __VA_ARGS__ ) ) \
{ \
fprintf( stderr, "%s:%d: check failed: %s\n", __func__, __LINE__, ( #__VA_ARGS__ ) ); \
abort(); \
}

◆ TEST_ASSERT_FLOAT_EQUAL_APPROX

#define TEST_ASSERT_FLOAT_EQUAL_APPROX ( val,
exp,
eps )
Value:
if ( !( fabs( val - exp ) <= eps ) ) \
{ \
fprintf( stderr, "%s:%d: check failed: expected %f (delta %f), got %f (delta %f)\n", __func__, __LINE__, exp, eps, val, fabs( val - exp ) ); \
abort(); \
}

◆ TEST_ASSERT_INT_EQUAL

#define TEST_ASSERT_INT_EQUAL ( val,
exp )
Value:
if ( !( val == exp ) ) \
{ \
fprintf( stderr, "%s:%d: check failed: expected %d, got %d\n", __func__, __LINE__, exp, val ); \
abort(); \
}