Fixed ptest compile errors

This commit is contained in:
Daniel Holden
2015-03-10 10:50:29 +00:00
parent dba739cd3d
commit 6a8dc2e3f9
2 changed files with 8 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ enum {
LIGHT_YELLOW = 14, LIGHT_YELLOW = 14,
LIGHT_WHITE = 15, LIGHT_WHITE = 15,
DEFAULT = 16, DEFAULT = 16
}; };
#ifdef _WIN32 #ifdef _WIN32
@@ -106,8 +106,7 @@ static char assert_err[MAX_ERROR];
static char assert_err_buff[MAX_ERROR]; static char assert_err_buff[MAX_ERROR];
static int assert_err_num = 0; static int assert_err_num = 0;
void pt_assert_run( void pt_assert_run(int result, const char* expr, const char* file, int line) {
int result, const char* expr, const char* func, const char* file, int line) {
num_asserts++; num_asserts++;
test_passing = test_passing && result; test_passing = test_passing && result;
@@ -139,6 +138,7 @@ static void ptest_signal(int sig) {
case SIGSEGV: sprintf(assert_err_buff, case SIGSEGV: sprintf(assert_err_buff,
" %i. Segmentation Fault\n", assert_err_num+1); " %i. Segmentation Fault\n", assert_err_num+1);
break; break;
default: break;
} }
assert_err_num++; assert_err_num++;
@@ -240,7 +240,7 @@ static char current_suite[MAX_NAME];
int pt_run(void) { int pt_run(void) {
unsigned int i; int i;
double total; double total;
test_t test; test_t test;

View File

@@ -6,13 +6,13 @@
#define PT_SUITE(name) void name(void) #define PT_SUITE(name) void name(void)
#define PT_FUNC(name) static void name(void) #define PT_FUNC(name) static void name(void)
#define PT_REG(name) pt_add_test(name, #name, __func__) #define PT_REG(name) pt_add_test(name, #name)
#define PT_TEST(name) auto void name(void); PT_REG(name); void name(void) #define PT_TEST(name) auto void name(void); PT_REG(name); void name(void)
#define PT_ASSERT(expr) pt_assert_run((int)(expr), #expr, __func__, __FILE__, __LINE__) #define PT_ASSERT(expr) pt_assert_run((int)(expr), #expr, __FILE__, __LINE__)
#define PT_ASSERT_STR_EQ(fst, snd) pt_assert_run(strcmp(fst, snd) == 0, "strcmp( " #fst ", " #snd " ) == 0", __func__, __FILE__, __LINE__) #define PT_ASSERT_STR_EQ(fst, snd) pt_assert_run(strcmp(fst, snd) == 0, "strcmp( " #fst ", " #snd " ) == 0", __FILE__, __LINE__)
void pt_assert_run(int result, const char* expr, const char* func, const char* file, int line); void pt_assert_run(int result, const char* expr, const char* file, int line);
void pt_add_test(void (*func)(void), const char* name, const char* suite); void pt_add_test(void (*func)(void), const char* name, const char* suite);
void pt_add_suite(void (*func)(void)); void pt_add_suite(void (*func)(void));