コード例 #1
0
int main(int argc, char** argv)
{
    CU_SuiteInfo suites[] = {
        pro_expr_test_suite,
        pro_identifier_expr_test_suite,
        pro_string_expr_test_suite,
        pro_number_expr_test_suite,
        pro_let_expr_test_suite,
        pro_send_expr_test_suite,
        pro_become_expr_test_suite,
        CU_SUITE_INFO_NULL
    };
    
    // initialize the CUnit test registry
    if (CUE_SUCCESS != CU_initialize_registry())
        return CU_get_error();

    // add suites to the registry
    if (CUE_SUCCESS != CU_register_suites(suites))
    {
        CU_cleanup_registry();
        return CU_get_error();
    }

    // run all tests
    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}
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("TestCommunicationProtocol", 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, "testEventHandlerInvocation", testEventHandlerInvocation))) {
        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
/* 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();
}
コード例 #4
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("cryptography_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_twofish_decrypt_encrypt", test_twofish_decrypt_encrypt)) ||
            (NULL == CU_add_test(pSuite, "test_twofish_decrypt_encrypt_null", test_twofish_decrypt_encrypt_null))||
            (NULL == CU_add_test(pSuite, "test_twofish_decrypt_encrypt_wrong_size", test_twofish_decrypt_encrypt_wrong_size))||
            (NULL == CU_add_test(pSuite, "test_sha256_normal", test_sha256_normal))||
            (NULL == CU_add_test(pSuite, "test_sha512_normal", test_sha512_normal))||
            (NULL == CU_add_test(pSuite, "test_sha512_null", test_sha512_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();
}
コード例 #5
0
ファイル: libapol-tests.c プロジェクト: 0xroot/setools3
int main(void)
{
	if (CU_initialize_registry() != CUE_SUCCESS) {
		return CU_get_error();
	}

	CU_SuiteInfo suites[] = {
		{"Policy Version 21", policy_21_init, policy_21_cleanup, policy_21_tests},
		{"AV Rule Query", avrule_init, avrule_cleanup, avrule_tests},
		{"Domain Transition Analysis", dta_init, dta_cleanup, dta_tests},
		{"Infoflow Analysis", infoflow_init, infoflow_cleanup, infoflow_tests},
		{"Role Query", role_init, role_cleanup, role_tests},
		{"TE Rule Query", terule_init, terule_cleanup, terule_tests},
		{"User Query", user_init, user_cleanup, user_tests},
		{"Constrain query", constrain_init, constrain_cleanup, constrain_tests},
		CU_SUITE_INFO_NULL
	};

	CU_register_suites(suites);
	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	unsigned int num_failures = CU_get_number_of_failure_records();
	CU_cleanup_registry();
	return (int)num_failures;
}
コード例 #6
0
ファイル: dkbttst.c プロジェクト: fangbin/mem
int
main(void)
{
  /* initialize the CUnit test registry */
  if (CUE_SUCCESS != CU_initialize_registry())
    return CU_get_error();

  /* add a suite to the registry */
  if (1 == test_mman_suite())
    return CU_get_error();

  /* Run all tests using the basic interface */
  CU_basic_set_mode(CU_BRM_VERBOSE);
  CU_basic_run_tests();

  /* Report failures */
  printf("\n\nSummary of failures:\n");
  CU_basic_show_failures(CU_get_failure_list());

  /* Clean up registry and return */
  printf("\n\nCleaning ...");
  CU_cleanup_registry();
  return CU_get_error();

}
コード例 #7
0
ファイル: strategy.c プロジェクト: fabricereix/Blackjack
int main()
{
    CU_pSuite pSuite = NULL;
    if ( CUE_SUCCESS != CU_initialize_registry() )
        return CU_get_error();

    /* add a suite to the registry */
    pSuite = CU_add_suite( "max_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, "test_strategy_stand", test_strategy_stand)) ||
        (NULL == CU_add_test(pSuite, "test_strategy_dealer", test_strategy_dealer)) ||
        (NULL == CU_add_test(pSuite, "test_strategy_basic", test_strategy_basic))
    )
    {
        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");
    CU_cleanup_registry();
    return CU_get_error();
}
コード例 #8
0
int main(
        const int argc,
        const char* const * argv)
{
    int exitCode = 1;
    const char* progname = basename((char*) argv[0]);

    if (-1 == openulog(progname, 0, LOG_LOCAL0, "-")) {
        (void) fprintf(stderr, "Couldn't open logging system\n");
    }
    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_msm_init)
                        && CU_ADD_TEST(testSuite, test_locking)
                        && CU_ADD_TEST(testSuite, test_msm_put)
                        && CU_ADD_TEST(testSuite, test_msm_getPid)
                        && CU_ADD_TEST(testSuite, test_msm_removePid)
                        && CU_ADD_TEST(testSuite, test_msm_destroy)
                        ) {
                    CU_basic_set_mode(CU_BRM_VERBOSE);
                    (void) CU_basic_run_tests();
                }
            }

            exitCode = CU_get_number_of_tests_failed();
            CU_cleanup_registry();
        }
    }

    return exitCode;
}
コード例 #9
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();
}
コード例 #10
0
ファイル: test_inetutil.c プロジェクト: khallock/LDM
int
main(
    const int     argc,
    char* const*  argv)
{
    int         exitCode = EXIT_FAILURE;

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

        if (NULL != testSuite) {
            CU_ADD_TEST(testSuite, test_getDottedDecimal);
#           if WANT_MULTICAST
                CU_ADD_TEST(testSuite, test_sa_getInetSockAddr);
                CU_ADD_TEST(testSuite, test_sa_getInet6SockAddr);
                CU_ADD_TEST(testSuite, test_sa_parse);
                CU_ADD_TEST(testSuite, test_sa_parseWithDefaults);
#           endif

            if (-1 == openulog(basename(argv[0]), 0, LOG_LOCAL0, "-")) {
                (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 = EXIT_SUCCESS;
                }
            }
        }

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

    return exitCode;
}
コード例 #11
0
ファイル: server_test.cpp プロジェクト: csound/csound
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("perfthread 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 server", test_server))
        )
    {
        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
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();
}
コード例 #13
0
ファイル: prod_index_queue_test.c プロジェクト: khallock/LDM
int
main(
    const int           argc,
    const char* const*  argv)
{
    int         exitCode = EXIT_FAILURE;

    if (-1 == openulog(basename(argv[0]), 0, LOG_LOCAL0, "-")) {
        (void)fprintf(stderr, "Couldn't initialize logging system\n");
    }
    else {
        if (CUE_SUCCESS == CU_initialize_registry()) {
            CU_Suite*       testSuite = CU_add_suite(__FILE__, setup,
                teardown);

            if (NULL != testSuite) {
                CU_ADD_TEST(testSuite, test_add_get);
                CU_ADD_TEST(testSuite, test_order);

                if (CU_basic_run_tests() == CUE_SUCCESS)
                    exitCode = CU_get_number_of_failures();
            }

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

        log_free();
    } /* logging system initialized */

    return exitCode;
}
コード例 #14
0
ファイル: test_mm.c プロジェクト: coconan/cbs-scheduler
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();
}
コード例 #15
0
ファイル: test_result.c プロジェクト: tps12/tripping-sansa
int main()
{
    CU_pSuite suite = 0;

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

    suite = CU_add_suite("result functions", 0, 0);
    if (!suite)
        goto failed;

    if (!CU_ADD_TEST(suite, test_error) ||
        !CU_ADD_TEST(suite, test_blank_success) ||
        !CU_ADD_TEST(suite, test_success_with_entity) ||
        !CU_ADD_TEST(suite, test_entity_without_free) ||
        !CU_ADD_TEST(suite, test_free_result) ||
        !CU_ADD_TEST(suite, test_success_with_location) ||
        !CU_ADD_TEST(suite, test_success_with_entity_and_location) ||
        !CU_ADD_TEST(suite, test_success_with_cookie))
        goto failed;

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

failed:
    CU_cleanup_registry();
didnt_even_fail:
    return CU_get_error();
}
コード例 #16
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();
}
コード例 #17
0
ファイル: test_all.c プロジェクト: Tycale/SFC-SR
/* 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_suite_bulk_buffer, clean_suite_bulk_buffer);
   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 available space", testAVAILABLE_SPACE))
      )
   {
      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();
}
コード例 #18
0
ファイル: test_main.c プロジェクト: adamlincoln/openomf
int main(int argc, char **argv) {
    if(CU_initialize_registry() != CUE_SUCCESS) {
        return CU_get_error();
    }

    // Init suites
    CU_pSuite str_suite = CU_add_suite("String", NULL, NULL);
    if(str_suite == NULL) goto end;
    str_test_suite(str_suite);
    
    CU_pSuite hashmap_suite = CU_add_suite("Hashmap", NULL, NULL);
    if(hashmap_suite == NULL) goto end;
    hashmap_test_suite(hashmap_suite);

    CU_pSuite vector_suite = CU_add_suite("Vector", NULL, NULL);
    if(vector_suite == NULL) goto end;
    vector_test_suite(vector_suite);

    // Run tests
    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();
   
end:
    CU_cleanup_registry();
    return CU_get_error();
}
コード例 #19
0
int
main(int argc, char *argv[]) {
    CU_ErrorCode cu;
    CU_pSuite suite;
    const char *configpath, *mode = NULL;
    if (argc < 2) {
        fprintf(stderr, "please gives a configuration file\n");
        exit(-1);
    }

    cu = CU_initialize_registry();
    if (cu != CUE_SUCCESS) {
        fprintf(stderr, "error cunit initialization: %s\n", CU_get_error_msg());
        exit(-1);
    }
    configpath = argv[1];
    if (argc > 2)
        mode = argv[2];

    if (da_cloud_init(&config, configpath) == 0) {
        suite = CU_add_suite("da_cloud", NULL, NULL);
        CU_add_test(suite, "da_cloud_headers_test", da_cloud_headers_test);
        CU_add_test(suite, "da_cloud_simple_lookup", da_cloud_simple_lookup);
        CU_add_test(suite, "da_cloud_properties_test", da_cloud_properties_test);

        if (mode != NULL && strcasecmp(mode, "show") == 0)
            CU_basic_run_tests();
        else
            CU_automated_run_tests();
    }
    da_cloud_fini(&config);
    CU_cleanup_registry();

    return (0);
}
コード例 #20
0
ファイル: tests.c プロジェクト: DamJos/SINF1252-1
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("Tests pour build_index et filter_index", NULL, NULL);
    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_build_index_1", test_build_index_1) ||
	   NULL == CU_add_test(pSuite, "test_build_index_2", test_build_index_2) ||
	   NULL == CU_add_test(pSuite, "test_build_index_3", test_build_index_3) ||
	   NULL == CU_add_test(pSuite, "test_build_index_4", test_build_index_4) ||
	   NULL == CU_add_test(pSuite, "test_build_index_5", test_build_index_5) ||
	   NULL == CU_add_test(pSuite, "test_filter_index_1", test_filter_index_1) ||
	   NULL == CU_add_test(pSuite, "test_filter_index_2", test_filter_index_2) ||
	   NULL == CU_add_test(pSuite, "test_filter_index_3", test_filter_index_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();
}
コード例 #21
0
int main (int argc, char* argv[]) {

    /* Set proper working directory */
    if (argc == 1) {
        printf("Usage: test_vqec_utest <directory containing unit_test dir>\n\r");
    }
    else if (argc > 1 && argv[1]) {
        if (chdir(argv[1]) != 0) {
            printf("Could not set working directory");
        }
    }
    /* Initialize CUnit test registry */
    if (CUE_SUCCESS != CU_initialize_registry()) {
        return CU_get_error();
    }

    if (CUE_SUCCESS != CU_register_suites(suites_vqec)) {
        return CU_get_error();
    }

    /* Run all tests using CUnit Basic interface */
    CU_basic_set_mode(CU_BRM_VERBOSE);
    /* sa_ignore {} IGNORE_RETURN(1) */
    CU_basic_run_tests();

    CU_cleanup_registry();
    return CU_get_error();
}
コード例 #22
0
ファイル: pop3tests_tran.c プロジェクト: Savinos90/pop3corn
/************* 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( "transaction_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, "tran_correct_commands_test", tran_correct_commands_test)) || 
       (NULL == CU_add_test(pSuite, "tran_wrong_commands_test", tran_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(); 
} 
コード例 #23
0
int
main(int argc, char* argv[]) {
    int i;

    n = 10;
    x = (double *)malloc(sizeof(double) * n);
    y = (double *)malloc(sizeof(double) * n);
    a = (double **)malloc(sizeof(double *) * n);
    *a = (double *)malloc(sizeof(double) * n * n);
    for (i = 1; i < n; ++i) a[i] = a[i - 1] + n;

    CU_pSuite testSuite;
    CU_initialize_registry();
    testSuite = CU_add_suite("mymath.c TestSuite", NULL, NULL);

    CU_add_test(testSuite, "dot_product Test", test_dot_product);
    CU_add_test(testSuite, "update_step_vector Test", test_update_step_vector);
    CU_add_test(testSuite, "manhattan_norm Test", test_manhattan_norm);
    CU_add_test(testSuite, "euclidean_norm Test", test_euclidean_norm);
    CU_add_test(testSuite, "infinity_norm Test", test_infinity_norm);
    CU_add_test(testSuite, "gauss_seidel Test", test_gauss_seidel);
    CU_add_test(testSuite, "successive_over_relaxation Test", test_successive_over_relaxation);

    CU_console_run_tests();
    CU_cleanup_registry();

    free(x);
    free(y);
    free(*a);
    free(a);

    return 0;
}
コード例 #24
0
ファイル: gps_test.c プロジェクト: insadrone/InsaQuadDrone
int main(char** args) {

  // En cas de problème de la librairie, le programme de test s'arrete et affiche un message (par exemple : memory allocation failed).
  CU_set_error_action(CUEA_ABORT) ;

  // Initialisation
  printf("Initialisation des tests.\n") ;
  CU_initialize_registry() ;
  init_suites() ;
  
  // Lancement
  printf("Lancement des tests.\n") ;

  // Variante 1 : fabriquer un fichier XML
  CU_automated_run_tests() ;
  printf("Pour observer les resultats, ouvrir le fichier .xml dans firefox\n") ;
  printf("Copier le fichier de style dans le meme repertoire : \n") ;
  printf("cp /usr/local/share/CUnit/CUnit-Run.xsl .\n\n") ;
  
  // Variante 2 : interface interactive dans le terminal.
  //CU_curses_run_tests() ;
  CU_basic_run_tests();
  // Nettoyage final
  CU_cleanup_registry() ;
  
}
コード例 #25
0
int main(
        const int argc,
        const char* const * argv)
{
    int exitCode = 1; // Failure default
    int status = log_init(argv[0]);

    if (status) {
        (void) fprintf(stderr, "Couldn't initialize logging system\n");
    }
    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_fq_new) &&
                        CU_ADD_TEST(testSuite, test_fq_shutdown) &&
                        CU_ADD_TEST(testSuite, test_write_then_read) &&
                        CU_ADD_TEST(testSuite, test_concurrency)) {
                    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;
}
コード例 #26
0
ファイル: nvme_ctrlr_cmd_ut.c プロジェクト: jupiturliu/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("nvme_ctrlr_cmd", NULL, NULL);
	if (suite == NULL) {
		CU_cleanup_registry();
		return CU_get_error();
	}

	if (
		CU_add_test(suite, "test ctrlr cmd get_firmware_page", test_firmware_get_log_page) == NULL
		|| CU_add_test(suite, "test ctrlr cmd get_health_page", test_health_get_log_page) == NULL
		|| CU_add_test(suite, "test ctrlr cmd get_error_page", test_error_get_log_page) == NULL
		|| CU_add_test(suite, "test ctrlr cmd set_feature", test_set_feature_cmd) == NULL
		|| CU_add_test(suite, "test ctrlr cmd get_feature", test_get_feature_cmd) == NULL
		|| CU_add_test(suite, "test ctrlr cmd abort_cmd", test_abort_cmd) == NULL
		|| CU_add_test(suite, "test ctrlr cmd io_raw_cmd", test_io_raw_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;
}
コード例 #27
0
int
main(int argc, char **argv)
{
#ifdef AGS_WITH_LIBINSTPATCH  
  /* 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("AgsFuncitonalFFPlayerTest\0", ags_functional_ffplayer_test_init_suite, ags_functional_ffplayer_test_clean_suite);
  
  if(pSuite == NULL){
    CU_cleanup_registry();
    
    return CU_get_error();
  }
  
  g_atomic_int_set(&is_available,
		   FALSE);
  
  ags_test_init(&argc, &argv,
		AGS_FUNCTIONAL_FFPLAYER_TEST_CONFIG);
  ags_functional_test_util_do_run(argc, argv,
				  ags_functional_ffplayer_test_add_test, &is_available);

  pthread_join(ags_functional_test_util_self()[0],
	       NULL);

  return(-1);
#else
  return(0);
#endif
}
コード例 #28
0
ファイル: odp_cunit_common.c プロジェクト: nmorey/odp
/*
 * Register test suites to be run via odp_cunit_run()
 */
int odp_cunit_register(odp_suiteinfo_t testsuites[])
{
    /* call test executable init hook, if any */
    if (global_init_term.global_init_ptr) {
        if ((*global_init_term.global_init_ptr)(&instance) == 0) {
            /* After ODP initialization, set main thread's
             * CPU affinity to the 1st available control CPU core
             */
            int cpu = 0;
            odp_cpumask_t cpuset;

            odp_cpumask_zero(&cpuset);
            if (odp_cpumask_default_control(&cpuset, 1) == 1) {
                cpu = odp_cpumask_first(&cpuset);
                odph_odpthread_setaffinity(cpu);
            }
        } else {
            /* ODP initialization failed */
            return -1;
        }
    }

    CU_set_error_action(CUEA_ABORT);

    CU_initialize_registry();
    global_testsuites = testsuites;
    cunit_register_suites(testsuites);
    CU_set_fail_on_inactive(CU_FALSE);

    return 0;
}
コード例 #29
0
ファイル: main.c プロジェクト: pose/c-data-structures
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();
}
コード例 #30
0
ファイル: tests.c プロジェクト: UCL-INGI/SINF1252
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();
}