本文整理汇总了C++中CU_basic_set_mode函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_basic_set_mode函数的具体用法?C++ CU_basic_set_mode怎么用?C++ CU_basic_set_mode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CU_basic_set_mode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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: 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 */
/* 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: 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("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: main
/************* 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: main
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;
}
示例6: main
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;
}
示例7: main
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);
}
示例8: main
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();
}
示例9: 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("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();
}
示例10: main
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();
}
示例11: TcuExecute
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();
}
示例12: main
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;
}
示例13: 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("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();
}
示例14: 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("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;
}
示例15: main
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();
}