From 8f922d174e08026120363533dbf48349266ee7cb Mon Sep 17 00:00:00 2001 From: Graham Miller Date: Fri, 14 Jan 2011 13:40:52 -0500 Subject: Added tag 0.1 for changeset 74f74c375a95 --- test_main.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 test_main.c (limited to 'test_main.c') diff --git a/test_main.c b/test_main.c new file mode 100644 index 0000000..4c57fc1 --- /dev/null +++ b/test_main.c @@ -0,0 +1,58 @@ +#include "CUnit/Basic.h" +#include "CUnit/Console.h" +#include "CUnit/Automated.h" + +#include "gob.h" +#include "encode.h" +#include "encode_test.h" +#include + +int init_suite() { return 0; } +int clean_suite() { return 0; } + +int main() +{ + CU_pSuite pSuite = NULL; + + /* initialize the CUnit test registry */ + if (CUE_SUCCESS != CU_initialize_registry()) + return CU_get_error(); + + /* add a suite to the registry */ + pSuite = CU_add_suite("encode_suite", init_suite, clean_suite); + if (NULL == pSuite) { + CU_cleanup_registry(); + return CU_get_error(); + } + + /* add the tests to the suite */ + if ((NULL == CU_add_test(pSuite, "test_gob_encode_int", test_gob_encode_int)) || + (NULL == CU_add_test(pSuite, "test_gob_encode_unsigned_int", test_gob_encode_unsigned_int)) || + (NULL == CU_add_test(pSuite, "test_gob_encode_double", test_gob_encode_double)) || + (NULL == CU_add_test(pSuite, "test_gob_encode_string", test_gob_encode_string)) || + (NULL == CU_add_test(pSuite, "test_gob_encode_simple_type", test_gob_encode_simple_type)) || + (NULL == CU_add_test(pSuite, "test_gob_encode_more_complex_type", test_gob_encode_more_complex_type)) || + (NULL == CU_add_test(pSuite, "test_flip_unsigned_long_long", test_flip_unsigned_long_long))) + { + CU_cleanup_registry(); + return CU_get_error(); + } + + /* Run all tests using the basic interface */ + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + printf("\n"); + CU_basic_show_failures(CU_get_failure_list()); + printf("\n\n"); + + /* Run all tests using the automated interface */ + CU_automated_run_tests(); + CU_list_tests_to_file(); + + /* Run all tests using the console interface */ + //CU_console_run_tests(); + + /* Clean up registry and return */ + CU_cleanup_registry(); + return CU_get_error(); +} -- cgit v1.2.3