当前位置: 首页>>代码示例>>C++>>正文


C++ CU_basic_run_tests函数代码示例

本文整理汇总了C++中CU_basic_run_tests函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_basic_run_tests函数的具体用法?C++ CU_basic_run_tests怎么用?C++ CU_basic_run_tests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CU_basic_run_tests函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

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;
}
开发者ID:spdk,项目名称:spdk,代码行数:35,代码来源:bit_array_ut.c

示例2: main

int main(int argc, char **argv)
{

        /* Initialize CUnit. */
        if (CUE_SUCCESS != CU_initialize_registry())
                return CU_get_error();

        /* Here's an example test suite.  First we initialize the suit. */
        {
                CU_pSuite s = CU_add_suite("example test suite",
                                &init_suite_example,
                                &clean_suite_example);

                CU_add_test(s, "test of mm_malloc()", &test_malloc);
                CU_add_test(s, "test #1 of mm_malloc()", &test_malloc_1);
                CU_add_test(s, "test #2 of mm_malloc()", &test_malloc_2);
                CU_add_test(s, "test #3 of mm_malloc()", &test_malloc_3);
                CU_add_test(s, "test #4 of mm_malloc()", &test_malloc_4);
                CU_add_test(s, "test #5 of mm_malloc()", &test_malloc_5);
                CU_add_test(s, "test #6 of mm_malloc()", &test_malloc_6);
                CU_add_test(s, "test #1 of mm_realloc()", &test_realloc_1);
                CU_add_test(s, "test #2 of mm_realloc()", &test_realloc_2);
                CU_add_test(s, "test #3 of mm_realloc()", &test_realloc_3);
                CU_add_test(s, "test #4 of mm_realloc()", &test_realloc_4);
                CU_add_test(s, "test #5 of mm_realloc()", &test_realloc_5);
                CU_add_test(s, "test #1 of mm_free()", &test_free_1);
                CU_add_test(s, "test #2 of mm_free()", &test_free_2);
        }

        /* Actually run your tests here. */
        CU_basic_set_mode(CU_BRM_VERBOSE);
        CU_basic_run_tests();
        CU_cleanup_registry();
        return CU_get_error();
}
开发者ID:coconan,项目名称:cbs-scheduler,代码行数:35,代码来源:test_mm.c

示例3: main

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("google_oauth2_access_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, "testBuildAccessTokenRequestAsHtmlRequest", testBuildAccessTokenRequestAsHtmlRequest)) ||
            (NULL == CU_add_test(pSuite, "testBuildPostFieldsForRefreshingTheAccessToken", testBuildPostFieldsForRefreshingTheAccessToken)) ||
            (NULL == CU_add_test(pSuite, "testBuildPostFieldsForRequestingAnAccessToken", testBuildPostFieldsForRequestingAnAccessToken)) ||
            (NULL == CU_add_test(pSuite, "testMakeHttpsRequestWithResponse", testMakeHttpsRequestWithResponse)) ||
            (NULL == CU_add_test(pSuite, "testProcessIncomingAccessTokenResponse", testProcessIncomingAccessTokenResponse)) ||
            (NULL == CU_add_test(pSuite, "testProcessIncomingRefreshTokenResponse", testProcessIncomingRefreshTokenResponse)) ||
            (NULL == CU_add_test(pSuite, "testcheckIfErrorOccured", testcheckIfErrorOccured)))
    {
        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();
}
开发者ID:EarlOfEgo,项目名称:GoogleTasksClientLibrary,代码行数:35,代码来源:google_oauth2_access_test.c

示例4: main

/* 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();
}
开发者ID:gobbigustavo,项目名称:PaiDePiper,代码行数:34,代码来源:BlackBoxTest.c

示例5: main

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("gcd_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, "test_same_number", test_same_number)) ||
        (NULL == CU_add_test(pSuite, "test_nothing_common", test_nothing_common)) ||
        (NULL == CU_add_test(pSuite, "test_factorize", test_factorize)) ||
        (NULL == CU_add_test(pSuite, "test_gcd_ok", test_gcd_ok)) ||
        (NULL == CU_add_test(pSuite, "test_malloc_fail", test_malloc_fail)) ||
        (NULL == CU_add_test(pSuite, "test_malloc_equals_free", test_malloc_equals_free)) ||
        (NULL == CU_add_test(pSuite, "test_nb_threads", test_nb_threads)))
    {
        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();
}
开发者ID:UCL-INGI,项目名称:SINF1252,代码行数:35,代码来源:tests.c

示例6: main

int main(
        const int argc,
        const char* const * argv)
{
    int exitCode = 1; /* failure */

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

        if (NULL != testSuite) {
            const char* progname = basename((char*)argv[0]);

            CU_ADD_TEST(testSuite, test_create);
            CU_ADD_TEST(testSuite, test_get);
            CU_ADD_TEST(testSuite, test_write_lock);
            CU_ADD_TEST(testSuite, test_read_lock);
            CU_ADD_TEST(testSuite, test_multiple_write);
            CU_ADD_TEST(testSuite, test_multiple_read);

            if (log_init(progname)) {
                (void) fprintf(stderr, "Couldn't open logging system\n");
            }
            else {
                if (CU_basic_run_tests() == CUE_SUCCESS) {
                    if (0 == CU_get_number_of_failures())
                        exitCode = 0; /* success */
                }
            }
        }

        CU_cleanup_registry();
    } /* CUnit registry allocated */

    return exitCode;
}
开发者ID:Unidata,项目名称:LDM,代码行数:35,代码来源:testSemRWLock.c

示例7: main

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;
}
开发者ID:spdk,项目名称:spdk,代码行数:29,代码来源:subsystem_ut.c

示例8: main

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

   if (CUE_SUCCESS != create_tlv_suit()) {
       goto exit;
   }
   if (CUE_SUCCESS != create_uri_suit()) {
       goto exit;
   }
   if (CUE_SUCCESS != create_convert_numbers_suit()) {
       goto exit;
   }
   if (CUE_SUCCESS != create_tlv_json_suit()) {
       goto exit;
   }

   CU_basic_set_mode(CU_BRM_VERBOSE);
   CU_basic_run_tests();
exit:
   CU_cleanup_registry();
   return CU_get_error();
}
开发者ID:duanlhjoe,项目名称:wakaama,代码行数:25,代码来源:unittests.c

示例9: main

int main(int argc, char const *argv[]) {
	if (CUE_SUCCESS != CU_initialize_registry())
		return CU_get_error();
	CU_pSuite pSuite = NULL;
	pSuite = CU_add_suite("Suite de tests : libfractal", setup, teardown);
	if (NULL == pSuite) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if ((NULL == CU_add_test(pSuite, "Name", test_libfractal_ptr_not_null)) ||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_ptr_value_not_null)) ||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_get_name)) ||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_get_width)) ||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_get_height)) ||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_get_a)) ||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_get_b))||
			(NULL == CU_add_test(pSuite, "Name", test_libfractal_get_set_value))) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	CU_basic_run_tests();
	CU_basic_show_failures(CU_get_failure_list());
	CU_cleanup_registry();
	return 0;
}
开发者ID:pgonzalezalv,项目名称:os_project2,代码行数:25,代码来源:libfractal_test.c

示例10: main

int main(int argc, char const *argv[]) {
	if (CUE_SUCCESS != CU_initialize_registry())
		return CU_get_error();
	CU_pSuite pSuite = NULL;
	pSuite = CU_add_suite("Suite de tests : malloc", setup, teardown);
	if (NULL == pSuite) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if ((NULL == CU_add_test(pSuite, "Blocks réallouables", test_free_block_reallouable)) ||
	 		(NULL == CU_add_test(pSuite, "Pointeur non null", test_malloc_pointeur_non_null)) ||
			(NULL == CU_add_test(pSuite, "Deux pointeurs différents", test_malloc_deux_pointeurs_differents)) ||
			(NULL == CU_add_test(pSuite, "Size 0", test_malloc_size_0)) ||
			(NULL == CU_add_test(pSuite, "Pointeur invalide", test_free_malloc)) ||
			(NULL == CU_add_test(pSuite, "Test valeur", test_malloc_ajout)) ||
			(NULL == CU_add_test(pSuite, "Double Free", test_double_free)) ||
			(NULL == CU_add_test(pSuite, "Test Calloc", callocTest))) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	CU_basic_show_failures(CU_get_failure_list());
	CU_cleanup_registry();
	return 0;
}
开发者ID:CelineDknp,项目名称:Projet1-C,代码行数:26,代码来源:malloc_test.c

示例11: main

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());
}
开发者ID:medcat,项目名称:libtoml,代码行数:33,代码来源:test.c

示例12: liblinphone_tester_run_tests

int liblinphone_tester_run_tests(const char *suite_name, const char *test_name) {
	int i;
	int ret;
	/* initialize the CUnit test registry */
	if (CUE_SUCCESS != CU_initialize_registry())
		return CU_get_error();

	for (i = 0; i < liblinphone_tester_nb_test_suites(); i++) {
		run_test_suite(test_suite[i]);
	}

	if (suite_name){
		CU_pSuite suite;
		CU_basic_set_mode(CU_BRM_VERBOSE);
		suite=CU_get_suite(suite_name);
		if (!suite) {
			ms_error("Could not find suite '%s'. Available suites are:", suite_name);
			liblinphone_tester_list_suites();
			return -1;
		} else if (test_name) {
			CU_pTest test=CU_get_test_by_name(test_name, suite);
			if (!test) {
				ms_error("Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name);
				// do not use suite_name here, since this method is case sentisitive
				liblinphone_tester_list_suite_tests(suite->pName);
				return -2;
			} else {
				CU_ErrorCode err= CU_basic_run_test(suite, test);
				if (err != CUE_SUCCESS) ms_error("CU_basic_run_test error %d", err);
			}
		} else {
			CU_basic_run_suite(suite);
		}
	} else
	{
#if HAVE_CU_CURSES
		if (curses) {
			/* Run tests using the CUnit curses interface */
			CU_curses_run_tests();
		}
		else
#endif
		{
			/* Run all tests using the CUnit Basic interface */
			CU_basic_set_mode(CU_BRM_VERBOSE);
			CU_basic_run_tests();
		}
	}

	ret=CU_get_number_of_tests_failed()!=0;

	/* Redisplay list of failed tests on end */
	if (CU_get_number_of_failure_records()){
		CU_basic_show_failures(CU_get_failure_list());
		printf("\n");
	}

	CU_cleanup_registry();
	return ret;
}
开发者ID:brenttsai1148,项目名称:linphone-android,代码行数:60,代码来源:tester.c

示例13: main

/* 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*/
   if ((NULL == CU_add_test(pSuite, "test of test_listdir()", test_listdir)) ||
       (NULL == CU_add_test(pSuite, "test of test_movefile()", test_movefile)) ||
	   (NULL == CU_add_test(pSuite, "test of test_makefolder()", test_makefolder)) ||
	   (NULL == CU_add_test(pSuite, "test of test_checkfordir()", test_checkfordir)) ||
	   (NULL == CU_add_test(pSuite, "test of test_changedirdown()", test_changedirdown)) ||
	   (NULL == CU_add_test(pSuite, "test of test_dirconcat()", test_dirconcat)) ||
	   (NULL == CU_add_test(pSuite, "test of test_getfilename()", test_getfilename)))
   {
      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();
}
开发者ID:maxfalk,项目名称:Ioopm,代码行数:39,代码来源:musiclibdirtest.c

示例14: main

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();
}
开发者ID:DanielWieczorek,项目名称:dwilib,代码行数:35,代码来源:dwistring_test.c

示例15: main

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;
}
开发者ID:asfadmin,项目名称:ASF_MapReady,代码行数:32,代码来源:test_main.t.c


注:本文中的CU_basic_run_tests函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。