summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-06-29 22:44:26 +0000
committerMike Frysinger <vapier@gentoo.org>2005-06-29 22:44:26 +0000
commitcbe1e9b4852908ee0d7c1419958a70cd616bebe9 (patch)
treeafbfd0a7dc5039f7ecbc5e4bf0beb0e964591fcc /test
parent201e52dd6ffec156bef553431275426dfa2bb4f7 (diff)
touchups syntax and fix warning when using 64bit arches
Diffstat (limited to 'test')
-rw-r--r--test/testsuite.h39
1 files changed, 18 insertions, 21 deletions
diff --git a/test/testsuite.h b/test/testsuite.h
index 806a5c229..3465d328e 100644
--- a/test/testsuite.h
+++ b/test/testsuite.h
@@ -29,7 +29,6 @@
extern size_t test_number;
-
extern void init_testsuite(const char* testname);
extern void done_testing(void) __attribute__((noreturn));
extern void success_msg(int result, const char* command);
@@ -37,7 +36,6 @@ extern void error_msg(int result, int line, const char* file, const char* comman
#else
-
size_t test_number = 0;
static int failures = 0;
@@ -45,7 +43,7 @@ void error_msg(int result, int line, const char* file, const char* command)
{
failures++;
- printf("\nFAILED TEST %d: \n\t%s\n", test_number, command);
+ printf("\nFAILED TEST %lu: \n\t%s\n", (unsigned long)test_number, command);
printf("AT LINE: %d, FILE: %s\n\n", line, file);
}
@@ -63,7 +61,7 @@ void done_testing(void)
exit(EXIT_FAILURE);
} else {
printf("All functions tested sucessfully\n");
- exit( EXIT_SUCCESS );
+ exit(EXIT_SUCCESS);
}
}
@@ -75,43 +73,42 @@ void init_testsuite(const char* testname)
atexit(done_testing);
}
-#endif
+#endif /* __NO_TESTCODE__ */
-
-#define TEST_STRING_OUTPUT( command, expected_result ) \
+#define TEST_STRING_OUTPUT(command, expected_result) \
do { \
- int result=strcmp( command, expected_result); \
+ int result = strcmp(command, expected_result); \
test_number++; \
- if ( result == expected_result ) { \
- success_msg( result, "command"); \
+ if (result == expected_result) { \
+ success_msg(result, "command"); \
} else { \
error_msg(result, __LINE__, __FILE__, command); \
}; \
} while (0)
-
-#define TEST_NUMERIC( command, expected_result ) \
+
+#define TEST_NUMERIC(command, expected_result) \
do { \
- int result=(command); \
+ int result = (command); \
test_number++; \
- if ( result == expected_result ) { \
- success_msg( result, # command); \
+ if (result == expected_result) { \
+ success_msg(result, # command); \
} else { \
error_msg(result, __LINE__, __FILE__, # command); \
}; \
} while (0)
-
+
#define TEST(command) \
do { \
- int result=(command); \
+ int result = (command); \
test_number++; \
- if ( result == 1) { \
- success_msg( result, # command); \
+ if (result == 1) { \
+ success_msg(result, # command); \
} else { \
- error_msg(result, __LINE__, __FILE__, # command ); \
+ error_msg(result, __LINE__, __FILE__, # command); \
}; \
} while (0)
-#define STR_CMD(cmd) cmd
+#define STR_CMD(cmd) cmd
#endif /* TESTSUITE_H */