trick/include/trick/trick_tests.h
jmpenn fccf32093b
Explicitly specify void arg for C functions that take no arguments. (#670)
* Clock empty args to void

* command_line func empty args to void

* DataRecord func empty args to void

* debug_pause func empty args to void

* echojobs func empty args to void

* ExternalApplication func empty args to void

* FrameLog func empty args to void

* MasterSlave func empty args to void

* MonteCarlo func empty args to void

* outdllist func proto empty args to void

* sie func empty args to void

* SimTime func empty args to void

* UnitTest func empty args to void

* var_server func empty args to void

* wcs func empty args to void
2018-09-19 11:25:04 -05:00

103 lines
3.3 KiB
C

#include <math.h>
#ifdef TRICK_UNIT_TEST
#define TRICK_EXPECT_TRUE( a , test_suite , test_case) \
if ( a ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_TRUE failed" ) ; \
}
#define TRICK_EXPECT_FALSE( a , test_suite , test_case) \
if ( !(a) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_FALSE failed" ) ; \
}
#define TRICK_EXPECT_EQ( a , b , test_suite , test_case) \
if ( (a) == (b) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_EQ failed" ) ; \
}
#define TRICK_EXPECT_NE( a , b , test_suite , test_case) \
if ( (a) != (b) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_NE failed" ) ; \
}
#define TRICK_EXPECT_LT( a , b , test_suite , test_case) \
if ( (a) < (b) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_LT failed" ) ; \
}
#define TRICK_EXPECT_LE( a , b , test_suite , test_case) \
if ( (a) <= (b) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_LE failed" ) ; \
}
#define TRICK_EXPECT_GT( a , b , test_suite , test_case) \
if ( (a) > (b) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_GT failed" ) ; \
}
#define TRICK_EXPECT_GE( a , b , test_suite , test_case) \
if ( (a) >= (b) ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "TRICK_EXPECT_GE failed" ) ; \
}
#define TRICK_EXPECT_NEAR( a , b , tol , test_suite , test_case) \
if ( fabs ( (a) - (b) ) < tol ) { \
add_test_result( test_suite , test_case , "" ) ; \
} else { \
add_test_result( test_suite , test_case , "floating point not within tolerance" ) ; \
}
#else
#define TRICK_EXPECT_TRUE( a , test_suite , test_case)
#define TRICK_EXPECT_FALSE( a , test_suite , test_case)
#define TRICK_EXPECT_EQ( a , test_suite , test_case)
#define TRICK_EXPECT_NE( a , test_suite , test_case)
#define TRICK_EXPECT_LT( a , test_suite , test_case)
#define TRICK_EXPECT_LE( a , test_suite , test_case)
#define TRICK_EXPECT_GT( a , test_suite , test_case)
#define TRICK_EXPECT_GE( a , test_suite , test_case)
#define TRICK_EXPECT_NEAR( a , b , tol , test_suite , test_case)
#endif
#ifdef __cplusplus
extern "C" {
#endif
int trick_test_enable(void) ;
int trick_test_set_file_name( const char * in_file_name ) ;
int trick_test_set_test_name( const char * in_test_name ) ;
int trick_test_add_parent(const char * in_test_suite_name,
const char * in_test_case,
const char * par_num ) ;
int add_test_result( const char * in_test_suite_name ,
const char * in_test_case ,
const char * in_failure_string ) ;
int call_write_output(void) ;
#ifdef __cplusplus
}
#endif