From: martinahansen Date: Tue, 21 Jul 2009 20:03:00 +0000 (+0000) Subject: added test_common.c X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e96662e126ff49e0102d4f6e4874261b7eab393a;p=biopieces.git added test_common.c git-svn-id: http://biopieces.googlecode.com/svn/trunk@576 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_c/Maasha/src/test/test_common.c b/code_c/Maasha/src/test/test_common.c new file mode 100644 index 0000000..fd6f081 --- /dev/null +++ b/code_c/Maasha/src/test/test_common.c @@ -0,0 +1,58 @@ +#include "common.h" +#include "CUnit/Basic.h" + +int init_suite( void ) +{ + return 0; +} + +int clean_suite( void ) +{ + return 0; +} + +void test_def_TRUE() +{ + assert( TRUE == 1 ); +} + +void test_def_FALSE() +{ + assert( FALSE == 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( "Testing Common", init_suite, clean_suite ); + + if ( NULL == pSuite ) { + CU_cleanup_registry(); + return CU_get_error(); + } + + /* add the tests to the suite */ + /* NOTE - ORDER IS IMPORTANT */ + if ( ( NULL == CU_add_test( pSuite, "test of def_TRUE()", test_def_TRUE ) ) || + ( NULL == CU_add_test( pSuite, "test of def_TRUE()", test_def_TRUE ) ) + ) + { + CU_cleanup_registry(); + return CU_get_error(); + } + + + + /* Run all tests using the CUnit Basic interface */ + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + CU_cleanup_registry(); + return CU_get_error(); +}