Пример #1
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();
}
Пример #2
0
int main(){
	CU_pSuite pSuite = NULL;

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

	pSuite = CU_add_suite("Suite de tests pour my-sem",init_suite1,clean_suite1);
	if(pSuite == NULL){
		CU_cleanup_registry();
		return CU_get_error();
	}
	if(CU_add_test(pSuite, "test_wait_bloquant",test_wait_bloquant) == NULL ||
       CU_add_test(pSuite,"test_wait_add_end",test_wait_add_end) == NULL || 
       CU_add_test(pSuite,"test_post_count",test_post_count) == NULL||
       //CU_add_test(pSuite,"test_post_take_first",test_post_take_first) == NULL ||
       CU_add_test(pSuite,"test_post_destroy",test_post_destroy) == NULL ||
       CU_add_test(pSuite,"test_post_exceed_capacity",test_post_exceed_capacity) == NULL) {

	    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();
}
Пример #3
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(); 
} 
Пример #4
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,"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();
}
Пример #5
0
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();

}
Пример #6
0
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;
}
Пример #7
0
int main(int argc, char **argv)
{
    int status;

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

    if(!(status = setup_object_tests())
        || !(status = setup_list_tests()))
    {
        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_automated_run_tests();
    CU_list_tests_to_file();

    //CU_console_run_tests();


    CU_cleanup_registry();

    return CU_get_error();
}
Пример #8
0
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;
}
Пример #9
0
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;
}
Пример #10
0
void bc_tester_uninit(void) {
	/* Redisplay list of failed tests on end */
	/*BUG: do not display list of failures on mingw, it crashes mysteriously*/
#if !defined(WIN32) && !defined(_MSC_VER)
	/* Redisplay list of failed tests on end */
	if (CU_get_number_of_failure_records()){
		CU_basic_show_failures(CU_get_failure_list());
	}
#endif
	CU_cleanup_registry();
	/*add missing final newline*/
	bc_tester_printf(bc_printf_verbosity_info,"");

	if( xml_enabled ){
		/*create real xml file only if tester did not crash*/
		char * xml_tmp_file = bc_sprintf("%s.tmp-Results.xml", xml_file);
		rename(xml_tmp_file, xml_file);
		free(xml_tmp_file);
	}

	if (test_suite != NULL) {
		free(test_suite);
		test_suite = NULL;
		nb_test_suites = 0;
	}

	if (bc_tester_resource_dir_prefix != NULL) {
		free(bc_tester_resource_dir_prefix);
		bc_tester_resource_dir_prefix = NULL;
	}
	if (bc_tester_writable_dir_prefix != NULL) {
		free(bc_tester_writable_dir_prefix);
		bc_tester_writable_dir_prefix = NULL;
	}
}
Пример #11
0
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();
}
Пример #12
0
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();
}
Пример #13
0
void bc_tester_uninit() {
	/* Redisplay list of failed tests on end */
	if (CU_get_number_of_failure_records()){
		CU_basic_show_failures(CU_get_failure_list());
	}
	CU_cleanup_registry();
	/*add missing final newline*/
	bc_tester_printf(bc_printf_verbosity_info,"");

	if( xml_enabled ){
		/*create real xml file only if tester did not crash*/
		size_t size = strlen(xml_file) + strlen(".tmp-Results.xml") + 1;
		char * xml_tmp_file = malloc(sizeof(char) * size);
		snprintf(xml_tmp_file, size, "%s.tmp-Results.xml", xml_file);
		rename(xml_tmp_file, xml_file);
		free(xml_tmp_file);
	}

	if (test_suite != NULL) {
		free(test_suite);
		test_suite = NULL;
		nb_test_suites = 0;
	}

	if (bc_tester_resource_dir_prefix != NULL) {
		free(bc_tester_resource_dir_prefix);
		bc_tester_resource_dir_prefix = NULL;
	}
	if (bc_tester_writable_dir_prefix != NULL) {
		free(bc_tester_writable_dir_prefix);
		bc_tester_writable_dir_prefix = NULL;
	}
}
/* 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();
}
Пример #15
0
int main() {
  // Set the library error handler to the custom one
  gmcmc_error_handler = cu_error_handler;

  // Initialise the CUnit test registry
  CU_ErrorCode error;
  if ((error = CU_initialize_registry()) != CUE_SUCCESS) {
    fprintf(stderr, "failed to initialise test registry: %s\n", CU_get_error_msg());
    return error;
  }
  
  // Create a test suite within the registry
  CU_pSuite suite;
  if ((suite = CU_add_suite("prior", NULL, NULL)) == NULL) {
    fprintf(stderr, "failed to create test suite: %s\n", CU_get_error_msg());
    return error;
  }
  
  // Add the tests to the suite
  if (CU_ADD_TEST(suite, test_prior_create) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }
  if (CU_ADD_TEST(suite, test_prior_sample) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }
  if (CU_ADD_TEST(suite, test_prior_evaluate) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }
  if (CU_ADD_TEST(suite, test_prior_evaluate_1st_order) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }
  if (CU_ADD_TEST(suite, test_prior_evaluate_2nd_order) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }

  // Run the test suites using the CUnit basic interface
  if ((error = CU_basic_run_tests()) != CUE_SUCCESS) {
    fprintf(stderr, "failed to run tests: %s\n", CU_get_error_msg());
    return error;
  }

  // Display any failures (plus hack for newline afterwards)
  CU_basic_show_failures(CU_get_failure_list());
  if (CU_get_number_of_failure_records() > 0) printf("\n");

  // Get the number of tests that failed
  unsigned int failures = CU_get_number_of_tests_failed();

  // Cleanup the test registry
  CU_cleanup_registry();

  // Return the number of test failures
  return (int)failures;
}
int main ( void )
{
   CU_pSuite suite_consumatorimolteplici_produttorimolteplici_bufferunitario_bloccante = NULL;
   CU_pSuite suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante = NULL;
   /* initialize the CUnit test registry */
   if ( CUE_SUCCESS != CU_initialize_registry() )
      return CU_get_error();

   /* add suite_consumatorimolteplici_bufferpieno_bloccante to the registry */
   suite_consumatorimolteplici_produttorimolteplici_bufferunitario_bloccante = CU_add_suite( "Consumazioni e produzioni concorrenti di molteplici messaggi in un buffer unitario: uso di chiamate bloccanti", init_suite_consumatorimolteplici_produttorimolteplici_bufferunitario, clean_suite_consumatorimolteplici_produttorimolteplici_bufferunitario );
   if ( NULL == suite_consumatorimolteplici_produttorimolteplici_bufferunitario_bloccante ) {
      CU_cleanup_registry();
      return CU_get_error();
   }
   /* add the tests to the suite suite_consumatorimolteplici_bufferpieno_bloccante */
   if ( (NULL == CU_add_test(suite_consumatorimolteplici_produttorimolteplici_bufferunitario_bloccante, "Stato del buffer: Valutazione iniziale dei semafori", test_iniziale_semafori_bloccante_bufferunitario)) ||
        (NULL == CU_add_test(suite_consumatorimolteplici_produttorimolteplici_bufferunitario_bloccante, "Lancio rispettivamente di due produzioni concorrenti prima di due estrazioni concorrenti", test_consumatorimolteplici_produttorimolteplici_bloccante_bufferunitario)) ||
        (NULL == CU_add_test(suite_consumatorimolteplici_produttorimolteplici_bufferunitario_bloccante, "Stato del buffer: Valutazione finale dei semafori", test_finale_semafori_bloccante_bufferunitario))
    )
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante to the registry */
   suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante = CU_add_suite( "Consumazioni e produzioni concorrenti di molteplici messaggi in un buffer unitario: uso di chiamate non bloccanti", init_suite_consumatorimolteplici_produttorimolteplici_bufferunitario, clean_suite_consumatorimolteplici_produttorimolteplici_bufferunitario);
   if ( NULL == suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante ) {
      CU_cleanup_registry();
      return CU_get_error();
   }
   /* add the tests to the suite suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante */
   if ( (NULL == CU_add_test(suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante, "Stato del buffer: Valutazione iniziale dei semafori", test_iniziale_semafori_nonbloccante_bufferunitario)) ||
        (NULL == CU_add_test(suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante, "Lancio rispettivamente di due produzioni concorrenti prima di due estrazioni concorrenti", test_consumatorimolteplici_produttorimolteplici_nonbloccante_bufferunitario)) ||
        (NULL == CU_add_test(suite_consumatorimolteplici_produttorimolteplici_bufferunitario_nonbloccante, "Stato del buffer: Valutazione finale dei semafori", test_finale_semafori_nonbloccante_bufferunitario))
    )
   {
      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");
/*
   // Run all tests using the automated interface
   CU_automated_run_tests();
   CU_list_tests_to_file();

   // Run all tests using the console interface
   CU_console_run_tests();
*/
   /* Clean up registry and return */
   CU_cleanup_registry();
   return CU_get_error();
}
Пример #17
0
int main(int argc, char** argv)
{
  CU_pFailureRecord FailureList;
  CU_RunSummary *pRunSummary;
  int FailRec;

  if(CU_initialize_registry())
  {
    fprintf(stderr, "Initialization of Test Registry failed.'n");
    return -1;
  }

  assert(CU_get_registry());
  assert(!CU_is_test_running());

  if(CU_register_suites(suites) != CUE_SUCCESS)
  {
    fprintf(stderr, "Register suites failed - %s\n", CU_get_error_msg());
    return -1;
  }

  CU_set_output_filename("lib-c");
  CU_list_tests_to_file();
  CU_automated_run_tests();

  pRunSummary = CU_get_run_summary();
  printf("Results:\n");
  printf("  Number of suites run: %d\n", pRunSummary->nSuitesRun);
  printf("  Number of suites failed: %d\n", pRunSummary->nSuitesFailed);
  printf("  Number of tests run: %d\n", pRunSummary->nTestsRun);
  printf("  Number of tests failed: %d\n", pRunSummary->nTestsFailed);
  printf("  Number of asserts: %d\n", pRunSummary->nAsserts);
  printf("  Number of asserts failed: %d\n", pRunSummary->nAssertsFailed);
  printf("  Number of failures: %d\n", pRunSummary->nFailureRecords);

  /* Print any failures */
  if (pRunSummary->nFailureRecords)
  {
    printf("\nFailures:\n");
    FailRec = 1;
    for (FailureList = CU_get_failure_list(); FailureList; FailureList = FailureList->pNext)
    {
      printf("%d. File: %s  Line: %u   Test: %s\n",
             FailRec,
             FailureList->strFileName,
             FailureList->uiLineNumber,
             (FailureList->pTest)->pName);
      printf("  %s\n",
             FailureList->strCondition);
      FailRec++;
    }
    printf("\n");
  }

  CU_cleanup_registry();

  return 0;
}
Пример #18
0
//--------------------------------------------------------------------------------------------------
static void test(void* context)
{
    // Init the test case / test suite data structures

    CU_TestInfo smstest[] =
    {
        { "Test le_sms_SetGetSmsCenterAddress()", Testle_sms_SetGetSmsCenterAddress },
        { "Test le_sms_SetGetText()",    Testle_sms_SetGetText },
        { "Test le_sms_SetGetBinary()",  Testle_sms_SetGetBinary },
        { "Test le_sms_SetGetPDU()",     Testle_sms_SetGetPDU },
        { "Test le_sms_ReceivedList()",  Testle_sms_ReceivedList },
        { "Test le_sms_SendBinary()",    Testle_sms_SendBinary },
        { "Test le_sms_SendText()",      Testle_sms_SendText },
#if 0
        { "Test le_sms_SendPdu()",       Testle_sms_SendPdu },
#endif
        CU_TEST_INFO_NULL,
    };


    CU_SuiteInfo suites[] =
    {
        { "SMS tests",                NULL, NULL, smstest },
        CU_SUITE_INFO_NULL,
    };

    fprintf(stderr, "Please ensure that there is enough space on SIM to receive new SMS messages!\n");

#ifndef AUTOMATIC
    GetTel();
#endif

    // Initialize the CUnit test registry and register the test suite
    if (CUE_SUCCESS != CU_initialize_registry())
        exit(CU_get_error());

    if ( CUE_SUCCESS != CU_register_suites(suites))
    {
        CU_cleanup_registry();
        exit(CU_get_error());
    }

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    // Output summary of failures, if there were any
    if ( CU_get_number_of_failures() > 0 )
    {
        fprintf(stdout,"\n [START]List of Failure :\n");
        CU_basic_show_failures(CU_get_failure_list());
        fprintf(stdout,"\n [STOP]List of Failure\n");
    }

}
Пример #19
0
//--------------------------------------------------------------------------------------------------
static void* test(void* context)
{
    // Init the test case / test suite data structures
    CU_TestInfo audiotest[] =
    {
        { "Test pa_audio_EnableCodecInput()"    , Test_pa_audio_EnableCodecInput },
        { "Test pa_audio_DisableCodecInput()"   , Test_pa_audio_DisableCodecInput },
        { "Test pa_audio_EnableCodecOutput()"   , Test_pa_audio_EnableCodecOutput },
        { "Test pa_audio_DisableCodecOutput()"  , Test_pa_audio_DisableCodecOutput },
        { "Test pa_audio_SetDspAudioPath()"     , Test_pa_audio_SetDspAudioPath },
        { "Test pa_audio_ResetDspAudioPath()"   , Test_pa_audio_ResetDspAudioPath },
        { "Test pa_audio_SetGain()"             , Test_pa_audio_SetGain },
        { "Test pa_audio_GetGain()"             , Test_pa_audio_GetGain },
        { "Test pa_audio_StartPlayback()"       , Test_pa_audio_StartPlayback },
        { "Test pa_audio_StopPlayback()"        , Test_pa_audio_StopPlayback },
        { "Test pa_audio_StartCapture()"        , Test_pa_audio_StartCapture },
        { "Test pa_audio_StopCapture()"         , Test_pa_audio_StopCapture },
        CU_TEST_INFO_NULL,
    };

    CU_SuiteInfo suites[] =
    {
        { "PA Audio tests",                NULL, NULL, audiotest },
        CU_SUITE_INFO_NULL,
    };

    // Initialize the CUnit test registry and register the test suite
    if (CUE_SUCCESS != CU_initialize_registry())
        exit(CU_get_error());

    if ( CUE_SUCCESS != CU_register_suites(suites))
    {
        CU_cleanup_registry();
        exit(CU_get_error());
    }

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    // Output summary of failures, if there were any
    if ( CU_get_number_of_failures() > 0 )
    {
        fprintf(stdout,"\n [START]List of Failure :\n");
        CU_basic_show_failures(CU_get_failure_list());
        fprintf(stdout,"\n [STOP]List of Failure\n");
        exit(EXIT_FAILURE);
    }

    exit(EXIT_SUCCESS);
}
Пример #20
0
int main() {
  // Initialise the CUnit test registry
  CU_ErrorCode error;
  if ((error = CU_initialize_registry()) != CUE_SUCCESS) {
    fprintf(stderr, "failed to initialise test registry: %s\n", CU_get_error_msg());
    return error;
  }

  // Create a test suite within the registry
  CU_pSuite suite;
  if ((suite = CU_add_suite("lognormal", test_init, test_cleanup)) == NULL) {
    fprintf(stderr, "failed to create test suite: %s\n", CU_get_error_msg());
    return error;
  }

  // Add the tests to the suite
  if (CU_ADD_TEST(suite, test_params) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }
  if (CU_ADD_TEST(suite, test_evaluation) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }
  if (CU_ADD_TEST(suite, test_statistics) == NULL) {
    fprintf(stderr, "failed to add test: %s\n", CU_get_error_msg());
    return error;
  }

  // Run the test suites using the CUnit basic interface
  if ((error = CU_basic_run_tests()) != CUE_SUCCESS) {
    fprintf(stderr, "failed to run tests: %s\n", CU_get_error_msg());
    return error;
  }

  // Display any failures (plus hack for newline afterwards)
  CU_basic_show_failures(CU_get_failure_list());
  if (CU_get_number_of_failure_records() > 0) printf("\n");

  // Get the number of tests that failed
  unsigned int failures = CU_get_number_of_tests_failed();

  // Cleanup the test registry
  CU_cleanup_registry();

  // Return the number of test failures
  return (int)failures;
}
Пример #21
0
/* MAIN */
int main(void) {
	fprintf(stderr, "I'm here!\n");
	CU_pSuite ste = NULL;

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

	ste = CU_add_suite("mutable_string_suite", init_mutable_string_suite, clean_mutable_string_suite);
	if (NULL == ste) {
		CU_cleanup_registry();
		return CU_get_error();
	}
	if (CU_get_error() != CUE_SUCCESS) {
		fprintf(stderr, "Error creating suite: (%d)%s\n", CU_get_error(), CU_get_error_msg());
	}

	ADD_TEST(CU_add_test(ste, "Verify mutable_string_init()...", t_mutable_string_init));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_init_with_value()...", t_mutable_string_init_with_value));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_resize()...", t_mutable_string_resize));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_assign()...", t_mutable_string_assign));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_append()...", t_mutable_string_append));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_copy()...", t_mutable_string_copy));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_append_mutable_string()...", t_mutable_string_append_mutable_string));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_append_char()...", t_mutable_string_append_char));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_char_at()...", t_mutable_string_char_at));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_substring()...", t_mutable_string_substring));
	ADD_TEST(CU_add_test(ste, "Verify mutable_string_int64/32/16()...", t_mutable_string_parse_int));
	// if (CU_get_error() != CUE_SUCCESS) {
		fprintf(stderr, "Error creating suite: (%d)%s\n", CU_get_error(), CU_get_error_msg());
	// }

	// CU_console_run_tests();
	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_ErrorCode run_errors = CU_basic_run_suite(ste);
	if (run_errors != CUE_SUCCESS) {
		fprintf(stderr, "Error running tests: (%d)%s\n", run_errors, CU_get_error_msg());
	}

	CU_basic_show_failures(CU_get_failure_list());
	CU_cleanup_registry();

	printf("\n");
	printf("I'm done!\n");

	return CU_get_error();
}
Пример #22
0
static int
RpcDebugRun(ToolsAppCtx *ctx,
            gpointer runMainLoop,
            gpointer runData,
            RpcDebugLibData *ldata)
{
   CU_ErrorCode err;
   CU_Suite *suite;
   CU_Test *test;

   ASSERT(runMainLoop != NULL);
   ASSERT(ldata != NULL);

   err = CU_initialize_registry();
   ASSERT(err == CUE_SUCCESS);

   suite = CU_add_suite(g_module_name(gPlugin), NULL, NULL);
   ASSERT(suite != NULL);

   test = CU_add_test(suite, g_module_name(gPlugin), RpcDebugRunLoop);
   ASSERT_NOT_IMPLEMENTED(test != NULL);

   gLibRunData.ctx = ctx;
   gLibRunData.libData = ldata;
   gLibRunData.mainLoop = runMainLoop;
   gLibRunData.loopData = runData;

   err = CU_basic_run_tests();

   /* Clean up internal library / debug plugin state. */
   ASSERT(g_atomic_int_get(&gLibRunData.refCount) >= 0);

   if (gPlugin != NULL) {
      g_module_close(gPlugin);
      gPlugin = NULL;
   }

   if (CU_get_failure_list() != NULL) {
      err = 1;
   }

   CU_cleanup_registry();
   memset(&gLibRunData, 0, sizeof gLibRunData);
   return (int) err;
}
Пример #23
0
int main ( void ){
   inicializaArvore(); //deve funcionar para as proximas funções funcionarem.
   createHeader(); //para as funçoes funcionarem o header deve ser criado, se o header foi criado então a função está correta
   
   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( "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, "Inserir", test_insere)) ||
        (NULL == CU_add_test(pSuite, "atualizar", test_atualiza)) ||
        (NULL == CU_add_test(pSuite, "excluir", test_exclui))
      )
   {
      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");
/*
   // Run all tests using the automated interface
   CU_automated_run_tests();
   CU_list_tests_to_file();

   // Run all tests using the console interface
   CU_console_run_tests();
*/
   /* Clean up registry and return */
   CU_cleanup_registry();
   return CU_get_error();
}
Пример #24
0
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( "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, "generate_payload_test", generate_payload_test)) ||
			(NULL == CU_add_test(pSuite, "draw_message_test", draw_message_test)) ||
			(NULL == CU_add_test(pSuite, "init_generator_test", init_generator_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");
	/*
   // Run all tests using the automated interface
   CU_automated_run_tests();
   CU_list_tests_to_file();

   // Run all tests using the console interface
   CU_console_run_tests();
	 */
	/* Clean up registry and return */
	CU_cleanup_registry();
	return CU_get_error();
}
Пример #25
0
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( "revcomp_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_initseq", test_initseq)) ||
        (NULL == CU_add_test(pSuite, "test_growseq", test_growseq)) ||
        (NULL == CU_add_test(pSuite, "test_reverse_str", test_reverse_str)) ||
        (NULL == CU_add_test(pSuite, "test_complement", test_complement))
   )
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   // Run all tests using the basic interface
   CU_basic_set_mode(CU_BRM_VERBOSE);
   CU_basic_run_suite(pSuite);
   printf("\n");
   CU_basic_show_failures(CU_get_failure_list());
   printf("\n\n");
   /*
     // Run all tests using the automated interface
     CU_automated_run_tests();
     CU_list_tests_to_file();

     // Run all tests using the console interface
     CU_console_run_tests();
   */
   /* Clean up registry and return */
   CU_cleanup_registry();
   return CU_get_error();
}
Пример #26
0
//--------------------------------------------------------------------------------------------------
static void* test(void* context)
{
    // Init the test case / test suite data structures
    CU_TestInfo simtestInteractive[] =
    {
        { "Test Interactive le_sim_Authentication()", TestInteractivele_sim_Authentication },
        { "Test le_sim_Create()",                     Testle_sim_Create },
        { "Test le_sim_States()",                     Testle_sim_States },
        CU_TEST_INFO_NULL,
    };


    CU_SuiteInfo suites[] =
    {
        { "SIM tests Interactive",    NULL, NULL, simtestInteractive },
        CU_SUITE_INFO_NULL,
    };

    // Initialize the CUnit test registry and register the test suite
    if (CUE_SUCCESS != CU_initialize_registry())
        exit(CU_get_error());

    if ( CUE_SUCCESS != CU_register_suites(suites))
    {
        CU_cleanup_registry();
        exit(CU_get_error());
    }

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    // Output summary of failures, if there were any
    if ( CU_get_number_of_failures() > 0 )
    {
        fprintf(stdout,"\n [START]List of Failure :\n");
        CU_basic_show_failures(CU_get_failure_list());
        fprintf(stdout,"\n [STOP]List of Failure\n");
    }

    le_event_RunLoop();
}
Пример #27
0
int main()
{
   CU_pSuite pSuite = NULL;
   if (CUE_SUCCESS != CU_initialize_registry())
      return CU_get_error();

   pSuite = CU_add_suite("Poly-Test-Suite", setup, teardown);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   if ((NULL == CU_add_test(pSuite, "Eval Func 1",test_eval_1)) ||
       (NULL == CU_add_test(pSuite, "Eval Func 2",test_eval_2)) ||
       (NULL == CU_add_test(pSuite, "Eval Func 3",test_eval_3)) ||
       (NULL == CU_add_test(pSuite, "Eval Func 4",test_eval_4)) ||
       (NULL == CU_add_test(pSuite, "Derivee Func 1",test_derivee_1)) ||
       (NULL == CU_add_test(pSuite, "Derivee Func 2",test_derivee_2)) ||
       (NULL == CU_add_test(pSuite, "Derivee Func 3",test_derivee_3)) ||
       (NULL == CU_add_test(pSuite, "Derivee Func 4",test_derivee_4)) ||
       (NULL == CU_add_test(pSuite, "Racine Func 1",test_racine_1)) ||
       (NULL == CU_add_test(pSuite, "Racine Func 2",test_racine_2)) ||
       (NULL == CU_add_test(pSuite, "Racine Func 3",test_racine_3)) ||
       (NULL == CU_add_test(pSuite, "Racine Func 4",test_racine_4))
     )
   {
     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();
}
Пример #28
0
/** Display the record of test failures in the detail window. */
static void show_failures(void)
{
  int i;
  CU_pFailureRecord pFailure = CU_get_failure_list();
  unsigned int nFailures = CU_get_number_of_failures();

  if (!create_pad(&details_pad, application_windows.pDetailsWin,
          nFailures == 0 ? 1 : nFailures + 5, 256)) {
    return;
  }

  if (0 == nFailures) {
    mvwprintw(details_pad.pPad, 0, 0, "%s", "No Failures.");
    refresh_details_window();
    return;
  }

  assert(pFailure);

  mvwprintw(details_pad.pPad, 1, 0, "%s", "   src_file:line# : (suite:test) : failure_condition");

  for (i = 0 ; pFailure ; pFailure = pFailure->pNext, i++) {
    char szTemp[256];

    snprintf(szTemp, 256, "%d. %s:%d : (%s : %s) : %s", i + 1,
        pFailure->strFileName ? pFailure->strFileName : "",
        pFailure->uiLineNumber,
        pFailure->pSuite ? pFailure->pSuite->pName : "",
        pFailure->pTest ? pFailure->pTest->pName : "",
        pFailure->strCondition ? pFailure->strCondition : "");

    mvwprintw(details_pad.pPad, i + 3, 0, "%s", szTemp);
  }

  mvwprintw(details_pad.pPad, i + 3, 0, "%s", "=============================================");
  mvwprintw(details_pad.pPad, i + 4, 0, "Total Number of Failures : %-d", nFailures);
  refresh_details_window();
}
Пример #29
0
int main (int argc, char** argv)
{
 if(CUE_SUCCESS != CU_initialize_registry())
   {return CU_get_error();}
  CU_pSuite suitePushPop = CU_add_suite("Tests de Push et Pop",NULL,NULL);
  if(NULL== suitePushPop)
   	{
	 CU_cleanup_registry();
	return CU_get_error();
	}
  if(NULL==CU_add_test(suitePushPop, "Test si push incrémente bien stack_height", pushTest1)||NULL==CU_add_test(suitePushPop, "Test si push place bien le double passé en paramètre sur la pile", pushTest2)||NULL==CU_add_test(suitePushPop, "Test pop décrémente stack_height", popTest1)||NULL==CU_add_test(suitePushPop, "Test valeur pop", popTest2))
	{CU_cleanup_registry();
	return CU_get_error();}

  CU_pSuite suiteSimple = CU_add_suite("Simple Tests",NULL,NULL);

  if(NULL== suiteSimple)
   	{
	 CU_cleanup_registry();
	return CU_get_error();
	}
  if(NULL==CU_add_test(suiteSimple, "Test addition", simpleAdd)||NULL==CU_add_test(suiteSimple, "Test difference", simpleDiff)||NULL==CU_add_test(suiteSimple, "Test multiplication", simpleMult)||NULL==CU_add_test(suiteSimple, "Test division", simpleDiv))
	{CU_cleanup_registry();
	return CU_get_error();}

  CU_pSuite suiteDouble = CU_add_suite("Double Tests",NULL,NULL);

  if(NULL== suiteDouble)
   	{
	 CU_cleanup_registry();
	return CU_get_error();
	}
  if(NULL==CU_add_test(suiteDouble, "Test addition then division", addDiv)||NULL==CU_add_test(suiteDouble, "Test division then substraction", divMinus)||NULL==CU_add_test(suiteDouble, "Test substraction then multiplication", minusTimes)||NULL==CU_add_test(suiteDouble, "Test multiplication then addition", timesAdd))
	{CU_cleanup_registry();
	return CU_get_error();}
CU_basic_run_tests();
CU_basic_show_failures(CU_get_failure_list());
}
Пример #30
0
int main(int argc, char** argv) {

    CU_pSuite suite_test_lab = NULL;

    argc = 0;
    argv = NULL;

    /*  initialize the CUnit test registry */

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

    if (NULL == (suite_test_lab = CU_add_suite("lab", initTestLab, cleanTestLab))) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    if (
            (NULL == CU_add_test(suite_test_lab, "test1                                                      ", test_lab))
            ) {
        CU_cleanup_registry();
        return CU_get_error();
    }

    /*
     * Run all tests using the basic interface
     *
     * CU_basic_run_tests(); -> Runs all tests in all registered suites
     * CU_basic_run_suite(CU_pSuite pSuite); -> Runs all tests in single specified suite
     * CU_basic_run_test(CU_pSuite pSuite, CU_pTest pTest); -> Runs a single test in a specified suite
     */

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

    /*
     * Run all tests using the automated interface
     */

    /*
    CU_automated_run_tests();
    CU_list_tests_to_file();
     */

    /*
     * Run all tests using the console interface
     */

    /*
        CU_console_run_tests();
     */

    /*
     * Run all tests using the curses interface
     * (only on systems having curses)
     */

    /*
        CU_curses_run_tests();
     */

    /*    Clean up registry and return */

    CU_cleanup_registry();
    return CU_get_error();

    return (EXIT_SUCCESS);
}