コード例 #1
0
ファイル: libcomponent_test.c プロジェクト: oskarhallbom/lab6
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( "libcomponent_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, "libcomponent_tests", libcomponent_tests))
        || (NULL == CU_add_test(pSuite, "power_of_ten_tests", power_of_ten_tests))
        || (NULL == CU_add_test(pSuite, "find_nearest_E12_tests", find_nearest_E12_tests))) 
   {
      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();
}
コード例 #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 */
  if ((NULL == CU_add_test(pSuite, "", test_empty_cyclic_buffer))
      || (NULL == CU_add_test(pSuite, "", test_one_element_cyclic_buffer))
      || (NULL == CU_add_test(pSuite, "", test_cyclic))
      || (NULL == CU_add_test(pSuite, "", test_empty_get))
      || (NULL == CU_add_test(pSuite, "", test_full_put))
      ) {
    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 setup_thumbnail_tests() {
	CU_pSuite pSuite = NULL;

	

	// Note: Uncomment this to generate the thumbnails, they should be examined by eye to make sure they are good 
	// before using them in tests.
	// generate_thumbnails();


   /* add a suite to the registry */
   pSuite = CU_add_suite("Thumbnails", NULL, NULL);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add the tests to the background scanning suite */
   if (
	   NULL == CU_add_test(pSuite, "Test thumbnail API", test_image_reading) ||
	   NULL == CU_add_test(pSuite, "Test thumbnail creation", test_thumbnailing)
	   )
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   return 0;

} /* setupbackground_tests() */
コード例 #4
0
ファイル: test.c プロジェクト: medcat/libtoml
int main(void)
{
	CU_pSuite pSuite = NULL;

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

	pSuite = CU_add_suite("toml suite", init_toml, fini_toml);
	if (NULL == pSuite)
		goto out;

	if ((NULL == CU_add_test(pSuite, "test fruit", testFruit)))
		goto out;

	if ((NULL == CU_add_test(pSuite, "test types", testTypes)))
		goto out;

	if ((NULL == CU_add_test(pSuite, "test hex", testHex)))
		goto out;

	if ((NULL == CU_add_test(pSuite, "test good examples", testGoodExamples)))
		goto out;

	if ((NULL == CU_add_test(pSuite, "test bad examples", testBadExamples)))
		goto out;

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();

out:
	CU_cleanup_registry();
	exit(CU_get_error());
}
コード例 #5
0
ファイル: cu_main.c プロジェクト: debosvi/bozVideo
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 init args", test_init_args))
        || (NULL == CU_add_test(pSuite, "test of term args", test_term_args))
        ) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* Run all tests using the CUnit Basic interface */
    CU_list_tests_to_file();
    CU_automated_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}
コード例 #6
0
ファイル: test_array.c プロジェクト: acasaccia/openomf
void array_test_suite(CU_pSuite suite) {
    // Add tests
    if(CU_add_test(suite, "Test for array create", test_array_create) == NULL) { return; }
    if(CU_add_test(suite, "Test for array set", test_array_set) == NULL) { return; }
    if(CU_add_test(suite, "Test for array get", test_array_get) == NULL) { return; }
    if(CU_add_test(suite, "Test for array free", test_array_free) == NULL) { return; }
}
コード例 #7
0
ファイル: test_lrumc.c プロジェクト: KevinQi1981/irid
int main()
{
	CU_pSuite ps = NULL;
	if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error();

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

	if (
		(NULL == CU_add_test(ps, "test_set_lrumc_data_buff()", test_set_lrumc_data_buff)) ||
		(NULL == CU_add_test(ps, "test_set_lrumc_data_int()", test_set_lrumc_data_int)) ||
		(NULL == CU_add_test(ps, "test_set_lrumc_data_double()", test_set_lrumc_data_double)) ||
		(NULL == CU_add_test(ps, "test_set_lrumc_data_object()", test_set_lrumc_data_object)) ||
		(NULL == CU_add_test(ps, "test_set_lrumc_data_bool()", test_set_lrumc_data_bool)) ||

		(NULL == CU_add_test(ps, "test_add_lrumc_data_buff()", test_add_lrumc_data_buff)) ||
		(NULL == CU_add_test(ps, "test_add_lrumc_data_int()", test_add_lrumc_data_int)) ||
		(NULL == CU_add_test(ps, "test_add_lrumc_data_double()", test_add_lrumc_data_double)) ||
		(NULL == CU_add_test(ps, "test_add_lrumc_data_object()", test_add_lrumc_data_object)) ||
		(NULL == CU_add_test(ps, "test_add_lrumc_data_bool()", test_add_lrumc_data_bool)) 

	) 
	{
		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();
}
コード例 #8
0
ファイル: newcunittest.c プロジェクト: vjine/discotmc
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("newcunittest", init_suite, clean_suite);
    if (NULL == pSuite) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* Add the tests to the suite */
    if (0 ||
            (NULL == CU_add_test(pSuite, "testScpi_glue_input", testScpi_glue_input)) ||
            (NULL == CU_add_test(pSuite, "test_output_matches", test_output_matches)) ||
            (NULL == CU_add_test(pSuite, "test_output_load", test_output_load)) ||
            (NULL == CU_add_test(pSuite, "test_bjarni3", test_bjarni3)) ||
            (NULL == CU_add_test(pSuite, "test_applyq", test_applyq)) ||
            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();
}
void
ags_functional_machine_add_and_destroy_test_add_test()
{  
  /* add the tests to the suite */
  if((CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsPanel", ags_functional_machine_add_and_destroy_test_panel) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsMixer", ags_functional_machine_add_and_destroy_test_mixer) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsSpectrometer", ags_functional_machine_add_and_destroy_test_spectrometer) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsEqualizer10", ags_functional_machine_add_and_destroy_test_equalizer10) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsDrum", ags_functional_machine_add_and_destroy_test_drum) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsMatrix", ags_functional_machine_add_and_destroy_test_matrix) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsSynth", ags_functional_machine_add_and_destroy_test_synth) == NULL) ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsSyncsynth", ags_functional_machine_add_and_destroy_test_syncsynth) == NULL)
#ifdef AGS_WITH_LIBINSTPATCH
     ||
     (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy AgsFFPlayer", ags_functional_machine_add_and_destroy_test_ffplayer) == NULL)
#endif
     || (CU_add_test(pSuite, "functional test of GSequencer machine add and destroy Audiorec", ags_functional_machine_add_and_destroy_test_audiorec) == NULL)
     ){
    
    CU_cleanup_registry();
      
    exit(CU_get_error());
  }
  
  /* Run all tests using the CUnit Basic interface */
  CU_basic_set_mode(CU_BRM_VERBOSE);
  CU_basic_run_tests();
  
  ags_test_quit();
  
  CU_cleanup_registry();
  
  exit(CU_get_error());
}
コード例 #10
0
ファイル: linked_list_test.c プロジェクト: jawi/celix
int main (int argc, char** argv) {
	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", setup, teardown);
	if (NULL == pSuite) {
	  CU_cleanup_registry();
	  return CU_get_error();
	}

	/* add the tests to the suite */
	if (NULL == CU_add_test(pSuite, "List Creation Test", test_linkedList_create) ||
		NULL == CU_add_test(pSuite, "List Add Test", test_linkedList_add) ||
		NULL == CU_add_test(pSuite, "List Remove Test", test_linkedList_remove))
	{
	  CU_cleanup_registry();
	  return CU_get_error();
	}

	CU_set_output_filename(argv[1]);
	CU_list_tests_to_file();
	CU_automated_run_tests();
	CU_cleanup_registry();
	return CU_get_error();
}
コード例 #11
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 CUnit Basic interface */
   CU_basic_set_mode(CU_BRM_VERBOSE);
   CU_basic_run_tests();
   CU_cleanup_registry();
   return CU_get_error();
}
コード例 #12
0
ファイル: tests.c プロジェクト: CharlyBVo/SINF1252
int main() {
    CU_pSuite pSuite = NULL;

    /* On initialise la suite de tests */
    if(CUE_SUCCESS != CU_initialize_registry())
        return CU_get_error();

    /* On ajoute la suite au registre */
    pSuite = CU_add_suite("Suite de tests pour calloc2", init_suite1, clean_suite1);
    if(NULL == pSuite) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* On ajoute les tests à la suite. L'ordre est important !
     * test_strlen1 sera exécuté en premier, puis test_strlen2, etc ...*/
    if(NULL == CU_add_test(pSuite, "test_calloc2_1", test_calloc2_1) ||
       NULL == CU_add_test(pSuite, "test_calloc2_2", test_calloc2_2) ||
       NULL == CU_add_test(pSuite, "test_calloc2_3", test_calloc2_3)
       ) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* On exécute les tests et on vide ensuite la mémoire utilisée par CUnit */
    CU_basic_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}
コード例 #13
0
ファイル: suite.c プロジェクト: avldya/guacamole-server
int register_protocol_suite() {

    /* Add protocol test suite */
    CU_pSuite suite = CU_add_suite("protocol",
                                   protocol_suite_init, protocol_suite_cleanup);
    if (suite == NULL) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /* Add tests */
    if (
        CU_add_test(suite, "base64-decode", test_base64_decode) == NULL
        || CU_add_test(suite, "instruction-parse", test_instruction_parse) == NULL
        || CU_add_test(suite, "instruction-read", test_instruction_read) == NULL
        || CU_add_test(suite, "instruction-write", test_instruction_write) == NULL
        || CU_add_test(suite, "nest-write", test_nest_write) == NULL
    ) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    return 0;

}
コード例 #14
0
/*
 *Function main.
 *This function builds the suite of tests.
 *After execution it shows a tabe that records all the tests and
 *that shows where there is an error.
 */
int main() {

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

    pSuite = CU_add_suite("Suite de tests pour sender.c et receiver.c", init_suite,clean_suite);
    if (NULL == pSuite) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    if( (NULL == CU_add_test(pSuite,"real address",real_add_test))||(NULL == CU_add_test(pSuite,"test create socket",test_create_socket)))
    {
        CU_cleanup_registry();
        return CU_get_error();
    }


    CU_basic_run_tests();
    CU_basic_show_failures(CU_get_failure_list());
    CU_cleanup_registry();
    return CU_get_error();
}
コード例 #15
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("Message Buffer 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, "Create Message Buffer", test_create_buffer))
           || (NULL == CU_add_test(pSuite, "Test run", test_buffer_run))
           )
   {
      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();
}
コード例 #16
0
ファイル: test_files.c プロジェクト: balhar-jakub/LLS
/* 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("test_files", 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, "testSaveMatrix", testSaveMatrix)) ||
            (NULL == CU_add_test(pSuite, "testSaveMatrixDifferent", testSaveMatrix2)) ||
            (NULL == CU_add_test(pSuite, "testSaveMatrixRectangle", testSaveMatrixRectangle))) {
        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();
}
コード例 #17
0
int main(int argc, char **argv) {
	opts_init();

	CU_pSuite maildir_suite = NULL;
	CU_pSuite regexp_suite = NULL;
	CU_pSuite fsm_suite = NULL;

	if (CU_initialize_registry() != CUE_SUCCESS) goto exit;

	if (!(maildir_suite = CU_add_suite("Test maildir.", init_maildir_suite, clean_maildir_suite))) goto clean;
	for (int i = 0; i < sizeof(maildir_tests) / sizeof(struct test); ++i) {
		if (!CU_add_test(maildir_suite, maildir_tests[i].name, maildir_tests[i].func)) goto clean;
	}

	if (!(regexp_suite = CU_add_suite("Test regexp.", init_regexp_suite, clean_regexp_suite))) goto clean;
	for (int i = 0; i < sizeof(regexp_tests) / sizeof(struct test); ++i) {
		if (!CU_add_test(regexp_suite, regexp_tests[i].name, regexp_tests[i].func)) goto clean;
	}

	if (!(fsm_suite = CU_add_suite("Test FSM.", init_fsm_suite, clean_fsm_suite))) goto clean;
	for (int i = 0; i < sizeof(fsm_tests) / sizeof(struct test); ++i) {
		if (!CU_add_test(fsm_suite, fsm_tests[i].name, fsm_tests[i].func)) goto clean;
	}

	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();

clean:
	CU_cleanup_registry();
exit:
	opts_final();
	return CU_get_error();
}
コード例 #18
0
ファイル: test-expander.c プロジェクト: Chainfire/selinux
int expander_add_tests(CU_pSuite suite)
{
	if (NULL == CU_add_test(suite, "expander_indexes", test_expander_indexes)) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (NULL == CU_add_test(suite, "expander_attr_mapping", test_expander_attr_mapping)) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (NULL == CU_add_test(suite, "expander_role_mapping", test_expander_role_mapping)) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if (NULL == CU_add_test(suite, "expander_user_mapping", test_expander_user_mapping)) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if (NULL == CU_add_test(suite, "expander_alias", test_expander_alias)) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	return 0;
}
コード例 #19
0
ファイル: test_main.t.c プロジェクト: asfadmin/ASF_MapReady
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("asf suite", NULL, NULL);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add the tests to the suite */
   if ((NULL == CU_add_test(pSuite, "vector", test_vector)) ||
       (NULL == CU_add_test(pSuite, "strUtil", test_strUtil)) ||
       (NULL == CU_add_test(pSuite, "solve1d", test_solve1d)) ||
       (NULL == CU_add_test(pSuite, "complex", test_complex)))
   {
      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 nfail = CU_get_number_of_failures();
   CU_cleanup_registry();
   return nfail>0;
}
コード例 #20
0
ファイル: bit_array_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("bit_array", NULL, NULL);
	if (suite == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (
		CU_add_test(suite, "test_1bit", test_1bit) == NULL ||
		CU_add_test(suite, "test_64bit", test_64bit) == NULL ||
		CU_add_test(suite, "test_find", test_find) == NULL ||
		CU_add_test(suite, "test_resize", test_resize) == NULL ||
		CU_add_test(suite, "test_errors", test_errors) == 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;
}
コード例 #21
0
int
main(int argc, char **argv)
{
  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("AgsRecallIDTest", ags_recall_id_test_init_suite, ags_recall_id_test_clean_suite);
  
  if(pSuite == NULL){
    CU_cleanup_registry();
    
    return CU_get_error();
  }

  /* add the tests to the suite */
  if((CU_add_test(pSuite, "test of AgsRecallID find reycling context", ags_recall_id_test_find_recycling_context) == NULL) ||
     (CU_add_test(pSuite, "test of AgsRecallID find parent reycling context", ags_recall_id_test_find_parent_recycling_context) == NULL)){
    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());
}
コード例 #22
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("dwistring_test", 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_concat_null", test_concat_null)) ||
            (NULL == CU_add_test(pSuite, "test_concat_both_null", test_concat_both_null))||
            (NULL == CU_add_test(pSuite, "test_concat_both_null", test_concat_both_null))||
            (NULL == CU_add_test(pSuite, "test_concatall_three_values", test_concatall_three_values))||
            (NULL == CU_add_test(pSuite, "test_contains_char_positive", test_contains_char_positive))||
            (NULL == CU_add_test(pSuite, "test_contains_char_null", test_contains_char_null))||
            (NULL == CU_add_test(pSuite, "test_contains_char_empty", test_contains_char_empty))||
            (NULL == CU_add_test(pSuite, "test_null_string_normal", test_null_string_normal))||
            (NULL == CU_add_test(pSuite, "test_null_string_nullpointer", test_null_string_nullpointer))||
            (NULL == CU_add_test(pSuite, "test_concatall_first_null", test_concatall_first_null))) {
        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();
}
コード例 #23
0
ファイル: subsystem_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, "create_subsystem", nvmf_test_create_subsystem) == NULL ||
		CU_add_test(suite, "find_subsystem", nvmf_test_find_subsystem) == NULL ||
		CU_add_test(suite, "discovery_log", test_discovery_log) == 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;
}
コード例 #24
0
ファイル: RNAFeaturesTest.c プロジェクト: kn/rna_features
/* 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 find_base_pairs()", testFIND_BASE_PAIRS)) ||
       (NULL == CU_add_test(pSuite, "test of cotransfold()", testCOTRANSFOLD)) ||
	   (NULL == CU_add_test(pSuite, "test of classify_base_pairs()", testCLASSIFY_BASE_PAIRS)) ||
	   (NULL == CU_add_test(pSuite, "test of boltzmann()", testBOLTZMANN)))
   {
      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();
}
コード例 #25
0
ファイル: us900.c プロジェクト: DDvO/libest
/* The main() function for setting up and running the tests.
 * Returns a CUE_SUCCESS on successful running, another
 * CUnit error code on failure.
 */
int us900_add_suite (void)
{
#ifdef HAVE_CUNIT
   CU_pSuite pSuite = NULL;

   /* add a suite to the registry */
   pSuite = CU_add_suite("us900_srv_csrattrs", 
	                  us900_init_suite, 
			  us900_destroy_suite);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add the tests to the suite */
   if ((NULL == CU_add_test(pSuite, "CSR Server Attributes API1", us900_test1)) ||
       (NULL == CU_add_test(pSuite, "CSR Server Attributes API2", us900_test2)))
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   return CUE_SUCCESS;
#endif
}
コード例 #26
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, "test chord_reset"         , test_chord_reset))         ||
		(NULL == CU_add_test(pSuite, "test chord_touch_start"   , test_chord_touch_start))   ||
		(NULL == CU_add_test(pSuite, "test chord_touch_end"     , test_chord_touch_end))     ||
		(NULL == CU_add_test(pSuite, "test chord_state_is_empty", test_chord_state_is_empty))||
		(NULL == CU_add_test(pSuite, "test chord_state_bitmap"  , test_chord_state_bitmap))
	){
		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();
}
コード例 #27
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 merge", 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 merge", test_merge_suite1))
       || (NULL == CU_add_test(pSuite1, "test mergesort", test_merge_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();
}
コード例 #28
0
ファイル: logTest.c プロジェクト: jzendle/INIT-101-UTIL
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("logTest", 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, "test2", test2)) ||
            (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();
}
コード例 #29
0
ファイル: ut_cu.c プロジェクト: jianzi123/my_libucmq
int main(int argc, char *argv[])
{
    CU_pSuite suite = NULL;

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

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

    if (!CU_add_test(suite, "test1", testF) ||
        !CU_add_test(suite, "test2", testQ)) {
        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();
}
コード例 #30
0
ファイル: upload_part.c プロジェクト: ks3sdk/ks3-c-sdk
/* 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() {
    ks3_global_init();

    int ret = load_ak_sk();
    if (ret != 0) {
        printf("[ERROR] load ak, sk failed\n");
        return ret;
    }

    ret = CreateBucket(host, bucket);
    if (ret != 0) {
        printf("[ERROR] create bucket failed\n");
        return ret;
    }

    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();
        ks3_global_destroy();
        return CU_get_error();
    }

    /* add the tests to the suite */
    if (NULL == CU_add_test(pSuite, "test upload part para null\n", TEST_UPLOAD_PART_ALL_NULL)
        || NULL == CU_add_test(pSuite, "test upload part para return code null\n", TEST_UPLOAD_PART_RETURNCODE_NULL)
        || NULL == CU_add_test(pSuite, "test upload part para host\n", TEST_UPLOAD_PART_HOST)
        || NULL == CU_add_test(pSuite, "test upload part para bucket\n", TEST_UPLOAD_PART_BUCKET)
        || NULL == CU_add_test(pSuite, "test upload part para object\n", TEST_UPLOAD_PART_OBJECT)
        || NULL == CU_add_test(pSuite, "test upload part para key\n", TEST_UPLOAD_PART_KEY)
        || NULL == CU_add_test(pSuite, "test upload part para uploadid partnum\n", TEST_UPLOAD_PART_UPLOAD_PARTNUM)
        || NULL == CU_add_test(pSuite, "test upload part para query\n", TEST_UPLOAD_PART_QUERYPARA)
        || NULL == CU_add_test(pSuite, "test upload part para header\n", TEST_UPLOAD_PART_HEADERPARA)
        || NULL == CU_add_test(pSuite, "clean bucket\n", clean)) {
        CU_cleanup_registry();
        ks3_global_destroy();
        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();

    ret = DeleteBucket(host, bucket);
    if (ret != 0) {
        printf("[ERROR] delete bucket failed\n");
    }

    ks3_global_destroy();
    return CU_get_error();
}