示例#1
0
int main(int argc, char **argv)
{
    /* Initialize the CUnit test registry */
    if ( CUE_SUCCESS != CU_initialize_registry())
        return CU_get_error();

    /* add a suite to the registry */
    CU_pSuite bstSuite = CU_add_suite("BST Suite", init_bst_suite, clean_bst_suite);
    CU_pSuite llSuite = CU_add_suite("LinkedList Suite", init_ll_suite, clean_ll_suite);
    CU_pSuite htSuite = CU_add_suite("HashTable Suite", init_ht_suite, clean_ht_suite);

    if ( NULL == bstSuite || NULL == llSuite || NULL == htSuite ) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /*add the test cases to the suites */
    if ((NULL == CU_add_test(bstSuite, "test_bst", test_bst)) || 
        (NULL == CU_add_test(llSuite, "test_ll", test_ll)) ||
        (NULL == CU_add_test(htSuite, "test_ht", test_ht)) ) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}
示例#2
0
/* 
 * The main() function for setting up and running the tests.
 * Returns a CUE_SUCCESS on successful running, another
 * CUnit error code on failure.
 *
 */
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("Suite_1", init_suite1, clean_suite1);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add the tests to the suite */
   /* add extra tests using || */
   
   //if (NULL == CU_add_test(pSuite, "test_next_id", test_next_id) ||
   	if(NULL == CU_add_test(pSuite, "test_start_new_cycle_postion", test_start_new_cycle_postion) ||
   	   NULL == CU_add_test(pSuite, "test_g0", test_g0) ||
   	   NULL == CU_add_test(pSuite, "test_nong0", test_nong0) ||
	   NULL == CU_add_test(pSuite, "test_differentiate_stem_z", test_differentiate_stem_z) ||
   	   NULL == CU_add_test(pSuite, "test_migrate", test_migrate))
   {
      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();
}
示例#3
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("Parser", 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, "SCPI_ParamInt", testSCPI_ParamInt))
            || (NULL == CU_add_test(pSuite, "SCPI_ParamDouble", testSCPI_ParamDouble))
            || (NULL == CU_add_test(pSuite, "SCPI_ParamCharacters", testSCPI_ParamCharacters))
	    || (NULL == CU_add_test(pSuite, "Commands handling", testCommandsHandling))
	    || (NULL == CU_add_test(pSuite, "Error handling", testErrorHandling))
	    || (NULL == CU_add_test(pSuite, "IEEE 488.2 Mandatory commands", testIEEE4882))
            ) {
        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();
}
示例#4
0
/************* Test Runner Code goes here **************/ 
int main ( void ) 
{ 
  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( "authentication_test_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, "auth_correct_commands_test", authentication_correct_commands_test)) || 
       (NULL == CU_add_test(pSuite, "auth_wrong_commands_test", authentication_wrong_commands_test)) 
       ) 
    { 
      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"); 
    
  /* Clean up registry and return */ 
  CU_cleanup_registry(); 
  return CU_get_error(); 
} 
示例#5
0
int main(
        const int argc,
        const char* const * argv)
{
    int exitCode = 1;
    const char* progname = basename((char*) argv[0]);

    (void)log_init(progname);

    if (CUE_SUCCESS == CU_initialize_registry()) {
        CU_Suite* testSuite = CU_add_suite(__FILE__, setup, teardown);

        if (NULL != testSuite) {
            if (CU_ADD_TEST(testSuite, test_exe_new) &&
                    CU_ADD_TEST(testSuite, test_exe_submit) &&
                    CU_ADD_TEST(testSuite, test_exe_shutdown_empty) &&
                    CU_ADD_TEST(testSuite, test_exe_shutdown) &&
                    CU_ADD_TEST(testSuite, test_submit_while_shutdown) &&
                    CU_ADD_TEST(testSuite, test_exe_clear)) {
                CU_basic_set_mode(CU_BRM_VERBOSE);
                (void) CU_basic_run_tests();
            }
        }

        exitCode = CU_get_number_of_tests_failed();
        CU_cleanup_registry();
    }

    log_free();

    return exitCode;
}
示例#6
0
int main(
        const int argc,
        const char* const * argv)
{
    int exitCode = 1;

    if (log_init(argv[0])) {
        log_syserr("Couldn't initialize logging module");
        exitCode = EXIT_FAILURE;
    }
    else {
        if (CUE_SUCCESS == CU_initialize_registry()) {
            CU_Suite* testSuite = CU_add_suite(__FILE__, setup, teardown);

            if (NULL != testSuite) {
                if (CU_ADD_TEST(testSuite, test_socketpair)) {
                    CU_basic_set_mode(CU_BRM_VERBOSE);
                    (void) CU_basic_run_tests();
                }
            }

            exitCode = CU_get_number_of_tests_failed();
            CU_cleanup_registry();
        }

        log_fini();
    }

    return exitCode;
}
示例#7
0
文件: t1.c 项目: CowanSM/ejdb
int main() {
    setlocale(LC_ALL, "en_US.UTF-8");
    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("t1", 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, "testSaveLoad", testSaveLoad)) ||
            (NULL == CU_add_test(pSuite, "testBuildQuery1", testBuildQuery1)) ||
            (NULL == CU_add_test(pSuite, "testDBOptions", testDBOptions))

            ) {
        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();
    int ret = CU_get_error() || CU_get_number_of_failures();
    CU_cleanup_registry();
    return ret;
}
示例#8
0
文件: main.c 项目: jjgreen/pia
int main(void)
{
  CU_BasicRunMode mode = CU_BRM_VERBOSE;
  CU_ErrorAction error_action = CUEA_IGNORE;
  setvbuf(stdout, NULL, _IONBF, 0);

  if (CU_initialize_registry())
    {
      fprintf(stderr,"failed to initialise registry\n");
      return EXIT_FAILURE;
    }

  tests_load();
  CU_basic_set_mode(mode);
  CU_set_error_action(error_action);

  int
    status = CU_basic_run_tests(),
    nfail = CU_get_number_of_failures();

  CU_cleanup_registry();
  printf("\nSuite returned %d.\n", status);

  return (nfail > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
示例#9
0
文件: test.c 项目: jafffy/CUnit-test
int main(void)
{
	CU_pSuite pSuite = NULL;

	if (CUE_SUCCESS != CU_initialize_registry())
		return CU_get_error();

	pSuite = CU_add_suite("Suite_1", init_suite1, clean_suite1);
	if (NULL == pSuite) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if ((NULL == CU_add_test(pSuite, "test of fprintf()", testFPRINTF)) ||
			(NULL == CU_add_test(pSuite, "test of fread()", testFREAD)))
	{
		CU_cleanup_registry();
		return CU_get_error();
	}

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	CU_cleanup_registry();

	return CU_get_error();
}
示例#10
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("SAMTest", 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, "test1", test1)) {
        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();
}
示例#11
0
int main ( void )
{
    CU_pSuite pSuite = NULL;

    if ( CUE_SUCCESS != CU_initialize_registry() )
        return CU_get_error();

    pSuite = CU_add_suite( "max_test_suite", init_suite, clean_suite );
    if ( NULL == pSuite ) {
        CU_cleanup_registry();
        return CU_get_error();
    }


    if ( (NULL == CU_add_test(pSuite, "max_test_1", max_test_1)) ||
            (NULL == CU_add_test(pSuite, "max_test_2", max_test_2)) ||
            (NULL == CU_add_test(pSuite, "max_test_3", max_test_3))
       )
    {
        CU_cleanup_registry();
        return CU_get_error();
    }


    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();
    printf("\n");
    CU_basic_show_failures(CU_get_failure_list());
    printf("\n\n");

    CU_cleanup_registry();
    return CU_get_error();
}
示例#12
0
void TcuExecute(void)
{
    if (TestGetAutomatic()) {
        if (TestGetFilename()) {
            CU_set_output_filename(TestGetFilename());
        }
        CU_automated_run_tests();
    }
    else if (TestGetBasic()) {
        CU_basic_set_mode(CU_BRM_VERBOSE);
        (void) CU_basic_run_tests();
    }
    else if (TestGetConsole()) {
        CU_console_run_tests();
    }
    else if (TestGetList()) {
        if (TestGetFilename()) {
            CU_set_output_filename(TestGetFilename());
        }
        (void) CU_list_tests_to_file();
    }

	if (CU_get_number_of_tests_failed()) {
		return;
	}

    /* Clean up the registry */

    CU_cleanup_registry();
}
示例#13
0
int main(int argc, char **argv)
{
	int failures;
	CU_pSuite pSuite = NULL;

	if (CU_initialize_registry() != CUE_SUCCESS) {
		printf("CU_initialize_registry() failed\n");
		return CU_get_error();
	}

	pSuite = CU_add_suite("IO interception library test",
			      NULL, NULL);

	if (!pSuite) {
		CU_cleanup_registry();
		printf("CU_add_suite() failed\n");
		return CU_get_error();
	}

	if (!CU_add_test(pSuite, "libioil sanity test", sanity)) {
		CU_cleanup_registry();
		printf("CU_add_test() failed\n");
		return CU_get_error();
	}

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	failures = CU_get_number_of_failures();
	CU_cleanup_registry();

	return failures;
}
示例#14
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("Suite_1", init_suite1, clean_suite1);
    if (NULL == pSuite) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* add the tests to the suite */
    if (
        (NULL == CU_add_test(pSuite, "Simple test", testSIMPLE)) ||
        (NULL == CU_add_test(pSuite, "cases.mpac test", testCasesMpac)) ||
        (NULL == CU_add_test(pSuite, "cases.mpac (part) test", testCasesMpacPart)) ||
        (NULL == CU_add_test(pSuite, "New spec str8 test", testNewSpecStr8)) ||
        (NULL == CU_add_test(pSuite, "New spec bin test", testNewSpecBin)) ||
        0)
    {
        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();
}
示例#15
0
文件: log_ut.c 项目: spdk/spdk
int main(int argc, char **argv)
{
	CU_pSuite	suite = NULL;
	unsigned int	num_failures;

	if (CU_initialize_registry() != CUE_SUCCESS) {
		return CU_get_error();
	}

	suite = CU_add_suite("log", NULL, NULL);
	if (suite == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (
		CU_add_test(suite, "log_ut", log_test) == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	num_failures = CU_get_number_of_failures();
	CU_cleanup_registry();
	return num_failures;
}
int main(int argc, char ** argv) {
    
    CU_ErrorCode rc;
    
    /* acknowledge+hide "unused parameter" compiler warnings */
    ACKNOWLEDGED_UNUSED(argc);
    ACKNOWLEDGED_UNUSED(argv);
    
    /* seed rng */
    srand((unsigned int)time(NULL));
    
    /* initialize the CUnit test registry */
    if (CUE_SUCCESS != CU_initialize_registry())
    {
        return CU_get_error();
    }
    
    
    /* ================ Add Test Suites to registry ================= */
    
    /* Test suite for Parallel Libmboard */
    if(testsuite_mb_parallel() != CUE_SUCCESS) return clean_quit();
 

    /* -------------------------------------------------------------- */
    
    
    /* Run all tests using the CUnit Basic interface */
    CU_basic_set_mode(CU_BRM_VERBOSE);
    rc = CU_basic_run_tests();
    
    /* clean up registry and quit */
    return clean_quit();
}
示例#17
0
int
main ()
{
    CU_pSuite pSuite1 = NULL;

    /* initialize registry */
    if (CUE_SUCCESS != CU_initialize_registry())
        return CU_get_error();

    /* add suites to registry */
    pSuite1 = CU_add_suite("Test quick", setup_suite1, teardown_suite1);

    if (pSuite1 == NULL) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* add tests to suite */
    if (  (NULL == CU_add_test(pSuite1, "test swap", test_swap_suite1))
       || (NULL == CU_add_test(pSuite1, "test partition", test_partition_suite1))
       || (NULL == CU_add_test(pSuite1, "test quicksort", test_quick_sort_suite1))  )
    {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* run tests */
    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    CU_cleanup_registry();
    return CU_get_error();
}
示例#18
0
文件: jotto.c 项目: dblack/cjotto
int main() {
    CU_BasicRunMode mode = CU_BRM_VERBOSE;
    CU_ErrorAction error_action = CUEA_IGNORE;
  
    CU_ErrorCode cue = CU_initialize_registry();
    if (cue != CUE_SUCCESS) { 
	printf("ERROR in CU_initialize_registry\n");
	return;
    }
    CU_basic_set_mode(mode);
    CU_set_error_action(error_action);
  
    CU_pSuite hitCounting, wordAdding, wordChomping, wordChecking;

    hitCounting = CU_add_suite("Hit counting", my_suite_init, my_suite_clean);
    wordAdding = CU_add_suite("Word adding", my_suite_init, my_suite_clean);
    wordChecking = CU_add_suite("Word checking", my_suite_init, my_suite_clean);

    CU_ADD_TEST(hitCounting, test_5_hits);  
    CU_ADD_TEST(hitCounting, test_1_hits);  
    CU_ADD_TEST(hitCounting, test_no_hits);  
    CU_ADD_TEST(hitCounting, test_hits_out_of_order_do_not_count);


    CU_ADD_TEST(wordChecking, test_check_for_word_in_jdict);
    CU_ADD_TEST(wordChecking, test_winnowing_jdict);
  
    CU_basic_run_tests();
    CU_cleanup_registry();
}
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("csound_orc_semantics function tests", init_suite1, clean_suite1);
    if (NULL == pSuite) {
        CU_cleanup_registry();
        return CU_get_error();
    }
    
    /* add the tests to the suite */
    if ((NULL == CU_add_test(pSuite, "Test find_opcode2()", test_find_opcode2))
        || (NULL == CU_add_test(pSuite, "Test resolve_opcode()", test_resolve_opcode))
        || (NULL == CU_add_test(pSuite, "Test find_opcode_new()", test_find_opcode_new))
        || (NULL == CU_add_test(pSuite, "Test check_out_arg()", test_check_out_arg))
        || (NULL == CU_add_test(pSuite, "Test check_out_args()", test_check_out_args))
        || (NULL == CU_add_test(pSuite, "Test check_in_arg()", test_check_in_arg))
        || (NULL == CU_add_test(pSuite, "Test check_in_args()", test_check_in_args))
        )
    {
        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();
}
示例#20
0
int main(void) {
	CU_initialize_registry();

	CU_pSuite pSuite_cf_surname, pSuite_cf_name, pSuite_cf_date,
	          pSuite_cf_ctrl_code, pSuite_cf_generator;

	pSuite_cf_surname = CU_add_suite("cf_surname", init_suite_default,
			clean_suite_default);

	pSuite_cf_name = CU_add_suite("cf_name",init_suite_default,
				clean_suite_default);
	pSuite_cf_date = CU_add_suite("cf_date",init_suite_default,
				clean_suite_default);
	pSuite_cf_ctrl_code = CU_add_suite("cf_ctrl_code",init_suite_default,
				clean_suite_default);
	pSuite_cf_generator = CU_add_suite("cf_generator",init_suite_default,
				clean_suite_default);

	CU_add_test(pSuite_cf_surname, "surname2code()",
			test_surname2code);
	CU_add_test(pSuite_cf_name, "name2code()", test_name2code);
	CU_add_test(pSuite_cf_date, "date2code()", test_date2code);
	CU_add_test(pSuite_cf_ctrl_code, "cf_ctrl_code()",
			test_cf_ctrl_code);
	CU_add_test(pSuite_cf_generator, "cf_generator()",
			test_cf_generator);

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	CU_cleanup_registry();

	return CU_get_error();
}
示例#21
0
int main(int argc, char **argv) {
    CU_pSuite suite = NULL;

    if(CU_initialize_registry() != CUE_SUCCESS) {
        return CU_get_error();
    }

    // Init suite
    suite = CU_add_suite("Shadowdive", NULL, NULL);
    if(suite == NULL) {
        goto end;
    }
    
    // Add tests
    if(CU_add_test(suite, "test of sd_bk_create", test_sd_bk_create) == NULL) { goto end; }
    if(CU_add_test(suite, "test of sd_bk_delete", test_sd_bk_delete) == NULL) { goto end; }
    if(CU_add_test(suite, "test of sd_af_create", test_sd_af_create) == NULL) { goto end; }
    if(CU_add_test(suite, "test of sd_af_delete", test_sd_af_delete) == NULL) { goto end; }

    // Run tests
    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();
   
end:
    CU_cleanup_registry();
    return CU_get_error();
}
示例#22
0
int main(int argc, char **argv)
{
	CU_pSuite	suite = NULL;
	unsigned int	num_failures;

	if (CU_initialize_registry() != CUE_SUCCESS) {
		return CU_get_error();
	}

	suite = CU_add_suite("nvme_ns_cmd", NULL, NULL);
	if (suite == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (
		CU_add_test(suite, "split_test", split_test) == NULL
		|| CU_add_test(suite, "split_test2", split_test2) == NULL
		|| CU_add_test(suite, "split_test3", split_test3) == NULL
		|| CU_add_test(suite, "split_test4", split_test4) == NULL
		|| CU_add_test(suite, "nvme_ns_cmd_flush testing", test_nvme_ns_cmd_flush) == NULL
		|| CU_add_test(suite, "nvme_ns_cmd_deallocate testing", test_nvme_ns_cmd_deallocate) == NULL
	) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	num_failures = CU_get_number_of_failures();
	CU_cleanup_registry();
	return num_failures;
}
示例#23
0
int main(int argc, char *argv[]) {
  CU_pSuite pSuite = NULL;

  // Initialise CUnit registry
  if (CUE_SUCCESS != CU_initialize_registry()) {
    return CU_get_error();
  }

  // Add a suite to the registry
  pSuite = CU_add_suite("Suite 1", NULL, NULL);
  if (NULL == pSuite) {
    CU_cleanup_registry();
    return CU_get_error();
  }

  // Add the tests to the suite
  if (NULL == CU_add_test(pSuite, "Setter test", setter_test)) {
    CU_cleanup_registry();
    return CU_get_error();
  }

  // Run tests using basic interface
  CU_basic_set_mode(CU_BRM_VERBOSE);
  CU_basic_run_tests();
  CU_cleanup_registry();
  return CU_get_error();
}
示例#24
0
/* The main() function for setting up and running the tests.
 * Returns a CUE_SUCCESS on successful running, another
 * CUnit error code on failure.
 */
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("Suite_1", init_suite1, clean_suite1);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add the tests to the suite */
   /* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
   if ((NULL == CU_add_test(pSuite, "test of fprintf()", testFPRINTF)) ||
       (NULL == CU_add_test(pSuite, "test of fread()", testFREAD)))
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* Run all tests using the console interface */
   CU_basic_set_mode(CU_BRM_VERBOSE);
   CU_basic_run_tests();
   CU_cleanup_registry();
   return CU_get_error();
}
示例#25
0
int main()
{

    Tape* tape = tape_new();
    tape_increment(tape);
    tape_increment(tape);
    tape_move_forward(tape);
    tape_increment(tape);
    printf("%s\n", tape_to_string(tape));


    CU_pSuite pSuite = NULL;

    if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error();

    pSuite = CU_add_suite("Tape Tests", NULL, NULL);
    if (NULL == pSuite) 
    {
        CU_cleanup_registry();
        return CU_get_error();
    }

    CU_add_test(pSuite, "tape increment", testTapeIncrement);

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}
示例#26
0
文件: request_ut.c 项目: spdk/spdk
int main(int argc, char **argv)
{
	CU_pSuite	suite = NULL;
	unsigned int	num_failures;

	if (CU_initialize_registry() != CUE_SUCCESS) {
		return CU_get_error();
	}

	suite = CU_add_suite("nvmf", NULL, NULL);
	if (suite == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (
		CU_add_test(suite, "nvmf_process_discovery_command", test_nvmf_process_discovery_cmd) == NULL ||
		CU_add_test(suite, "nvmf_process_fabrics_command", test_nvmf_process_fabrics_cmd) == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	num_failures = CU_get_number_of_failures();
	CU_cleanup_registry();
	return num_failures;
}
int main()
{
	CU_pSuite pSuite = NULL;
	if (CU_initialize_registry() != CUE_SUCCESS) {
		return CU_get_error();
	}
	pSuite = CU_add_suite("Suite_1", init_suite1, clean_suite1);
	if (pSuite == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	
	if (CU_add_test(pSuite, "test of createsylvester() and destroysylvester()", testcreatesylvesteranddestroysylvester) == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if (CU_add_test(pSuite, "test of printsylvester()", testprintsylvester) == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if (CU_add_test(pSuite, "test of Svmult()", testSvmult) == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if (CU_add_test(pSuite, "test of SylvesterDeterminant()", testSylvesterDeterminant) == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	
	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	CU_cleanup_registry();
	return CU_get_error();
}
示例#28
0
int main() {
    setlocale(LC_ALL, "en_US.UTF-8");
    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("ejdbtest1", 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, "testTicket53", testTicket53)) ||
            (NULL == CU_add_test(pSuite, "testBSONExportImport", testBSONExportImport)) ||
            (NULL == CU_add_test(pSuite, "testBSONExportImport2", testBSONExportImport2)) ||
            (NULL == CU_add_test(pSuite, "testTicket135", testTicket135))
            ) {
        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();
    int ret = CU_get_error() || CU_get_number_of_failures();
    CU_cleanup_registry();
    return ret;
}
示例#29
0
文件: main.c 项目: FlexCOS/code
/* The main() function for setting up and running the tests.
 * Returns a CUE_SUCCESS on successful running, another
 * CUnit error code on failure.
 */
int main()
{
	int err_code = 0;

	/* initialize the CUnit test registry */
	if (CUE_SUCCESS != CU_initialize_registry())
		return CU_get_error();

	/* create suites, order is important */
	if ( (err_code = build_suite__types())       ||
	     (err_code = build_suite__stub_memdev()) ||
	     (err_code = build_suite__somefs())      ||
	     (err_code = build_suite__smartfs())     ||
	     (err_code = build_suite__flxio())       ||
	     (err_code = build_suite__apdu()))
	{
		return err_code;
	}

	/* 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();
}
/* MAIN */
int main(void) {
  CU_pSuite ste = NULL;

  if (CUE_SUCCESS != CU_initialize_registry()) {
    return CU_get_error();
  }

  ste = CU_add_suite("sllist_suite", init_sllist_suite, clean_sllist1_suite);
  if (NULL == ste) {
    CU_cleanup_registry();
    return CU_get_error();
  }

  ADD_TEST(CU_add_test(ste, "Verify insert...", t_insert));

  // CU_console_run_tests();
  CU_basic_set_mode(CU_BRM_VERBOSE);
  CU_basic_run_suite(ste);
  CU_basic_show_failures(CU_get_failure_list());
  CU_cleanup_registry();

  printf("\n");

  return CU_get_error();
}