Exemplo n.º 1
0
int main(int argc, char **argv)
{
    struct timeval start, end;
    double CurrentCPUTime;

    init_02 test_11("test_11");
    //-----------------------------------------------------------

    smpc::solver_ip solver(
            test_11.wmg->N, 
            2000, 
            150, 
            0.02, 
            1, 
            1e-3,
            1e-2,
            100, 
            15, 
            0.01, 
            0.5,
            100,
            smpc::SMPC_IP_BS_LOGBAR,
            true);

    for(int counter = 0; counter < 2; counter++)
    {
        //------------------------------------------------------
        if (test_11.wmg->formPreviewWindow(*test_11.par) == WMG_HALT)
        {
            cout << "EXIT (halt = 1)" << endl;
            break;
        }
        //------------------------------------------------------



        int NN = 1000;
        gettimeofday(&start,0);
        for(int kk=0; kk<NN ;kk++)
        {
            solver.set_parameters (test_11.par->T, test_11.par->h, test_11.par->h0, test_11.par->angle, test_11.par->fp_x, test_11.par->fp_y, test_11.par->lb, test_11.par->ub);
            solver.form_init_fp (test_11.par->fp_x, test_11.par->fp_y, test_11.par->init_state, test_11.par->X);
            solver.solve();
        }
        solver.get_next_state(test_11.par->init_state);
        gettimeofday(&end,0);             
        CurrentCPUTime = end.tv_sec - start.tv_sec + 0.000001 * (end.tv_usec - start.tv_usec);
        double TT = CurrentCPUTime/NN;
        printf("(%i) time = % f (ext = %d // int = %d // bs = %d)\n", 
                counter, 
                TT, 
                solver.ext_loop_iterations,
                solver.int_loop_iterations,
                solver.bt_search_iterations);
        //------------------------------------------------------
    }

    return 0;
}
Exemplo n.º 2
0
static void test_sllist(void) {
	test_1();
	test_2();
	test_3();
	test_4();
	test_5();
	test_6();
	test_8();
	test_9();
	test_10();
	test_11();
}
Exemplo n.º 3
0
void test() {
  test_1();
  test_2();
  test_3();
  test_4();
  test_5();
  test_6();
  test_7();
  test_8();
  test_9();
  test_10();
  test_11();
  test_12();
}
Exemplo n.º 4
0
int main () {

	#ifdef _DEBUG
		Profiler::set_total("ArrayHandler", 24);

		test_1 ();
		test_2 ();
		test_3 ();
		test_4 ();
		test_5 ();
		test_6 ();
		test_7 ();
		test_8 ();
		test_9 ();
		test_10 ();
		test_11 ();
		test_12 ();
		test_13 ();
		test_14 ();
		test_15 ();
		test_16 ();

		cout << "\n\nTesting iterators:\n\n";

		Profiler::set_total("ArrayIterator", 17);

		test_17 ();
		test_18 ();
		test_19 ();
		test_20 ();

		//Profiler::report();
		Profiler::report_to_file();

		cout << "------------------------------------------------------------\n\n";
		cout << "        CHECK Profiler data in Profiler_report.txt\n\n";
		cout << "  To show all debug info - comment line 12 in ArrayIterator.h\n\n";
		cout << "------------------------------------------------------------\n\n";


	#else
		cout << "Testing requires DEBUG mode.\n\n";
	#endif


	return EXIT_SUCCESS;
}
Exemplo n.º 5
0
int main()
{
  
  int i, j, k;
  int errors=0;
  int success=0;

  for (i=-2; i<20; i++)
	if (test_11(i)!=test_function(i))
	  errors++;
	else
	  success++;

  printf("success,%d\nerrors,%d\ntotal,%d\n",success,errors,success+errors);

  return 0;
}
Exemplo n.º 6
0
Arquivo: testcfg.c Projeto: 8l/rose
/* The main testfunction. Returns 0 if any error is found in the cfg */
int kfg_testit (KFG kfg, int quiet_mode)
{
  cfg           = kfg;
  quiet         = (quiet_mode == 1);
  error_found   = 0;

  diagnostic ("Consistency test of cfg and PAG-interface ");

  /* do the tests */
  if (0 != kfg_num_nodes (cfg))
    {
      if (error_found < 100) test_1 ();
      if (error_found < 100) test_2 ();
      if (error_found < 100) test_3 ();
      if (error_found < 100) test_4 ();
      if (error_found < 100) test_5 ();
      if (error_found < 100) test_6 ();
      if (error_found < 100) test_7 ();
      if (error_found < 100) test_8 ();
      if (error_found < 100) test_9 ();
      if (error_found < 100) test_10 ();
      if (error_found < 100) test_11 ();
      if (error_found < 100) test_12 ();
      if (error_found < 100) test_13 ();
    }

  /* tests for empty cfg's */
  else test_0 ();

  if (error_found == 0)
    diagnostic (" excellent!\n");
  else
    diagnostic (" ** errors found **\n");

  return (error_found == 0);
}
Exemplo n.º 7
0
//to choose that format (of those the device can support) that is equal or highest and
//closest tp the one that the user required. Also, write out those parameters which were changed
int audio_formatmatch(format_node *demanded, DWORD avail, long *flags)
{
    *flags = 0;
    if (demanded->srate <= 11025.0){
        if (test_11(avail)){
            if (demanded->srate < 11025.0){
                *flags = *flags | SND_HEAD_SRATE;
                demanded->srate = 11025.0;
            }
        }else { 
            *flags = *flags | SND_HEAD_SRATE;
            if (test_22(avail))
                demanded->srate = 22050.0;
            else if (test_44(avail))
                demanded->srate = 44100.0;
            else {
                snd_fail("No available sample-rate (internal error)");
                return(!SND_SUCCESS);
            }
        }
    }else if (demanded->srate <= 22050.0) {
        if (test_22(avail)){
            if (demanded->srate < 22050.0){
                *flags = *flags | SND_HEAD_SRATE;
                demanded->srate = 22050.0;
            }
        }else { 
            *flags = *flags | SND_HEAD_SRATE;
            if (test_44(avail))
                demanded->srate = 44100.0;
            else if (test_11(avail))
                demanded->srate = 11025.0;
            else {
                snd_fail("No available sample-rate (internal error)");
                return(!SND_SUCCESS);
            }
        }
    }else if (demanded->srate <= 44100.0) {
        if (test_44(avail)){
            if (demanded->srate < 44100.0){
                *flags = *flags | SND_HEAD_SRATE;
                demanded->srate = 44100.0;
            }
        }else { 
            *flags = *flags | SND_HEAD_SRATE;
            if (test_22(avail))
                demanded->srate = 22050.0;
            else if (test_11(avail))
                demanded->srate = 11025.0;
            else {
                snd_fail("No available sample-rate (internal error)");
                return(!SND_SUCCESS);
            }
        }
    }else { /* srate > 44100 */
        *flags = *flags | SND_HEAD_SRATE;
        if (test_44(avail))
            demanded->srate = 44100.0;
        else if (test_22(avail))
            demanded->srate = 22050.0;
        else if (test_11(avail))
            demanded->srate = 11025.0;
        else {
            snd_fail("No available sample-rate (internal error)");
            return(!SND_SUCCESS);
        }
    }

    if (demanded->bits <= 8){
        if (test_8bit(avail)){
            if (demanded->bits < 8){
                *flags = *flags | SND_HEAD_BITS;
                demanded->bits = 8;
            }
        }else { 
            *flags = *flags | SND_HEAD_BITS;
            if (test_16bit(avail))
                demanded->bits = 16;
            else {
                snd_fail("No available bit number (internal error)");
                return(!SND_SUCCESS);
            }
        }
    }else { /* either between 8 and 16 bit, or higher than 16 bit -> use 16 bit */
        if (test_16bit(avail)){
            if (demanded->bits != 16){
                *flags = *flags | SND_HEAD_BITS;
                demanded->bits = 16;
            }
        }else { 
            *flags = *flags | SND_HEAD_BITS;
            if (test_8bit(avail))
                demanded->bits = 8;
            else {
                snd_fail("No available bit number (internal error)");
                return(!SND_SUCCESS);
            }
        }
    }

    if (demanded->channels == 1){
        if (!(test_mono(avail))){
            *flags = *flags | SND_HEAD_CHANNELS;
            if (test_stereo(avail))
                demanded->channels = 2;
            else {
                snd_fail("No available channels number (internal error)");
                return(!SND_SUCCESS);
            }
        }
    } else { /* otherwise, use stereo (for channels >= 2, or for invalid number, that is <1) */
        if (test_stereo(avail)){
            if (demanded->channels != 2){
                *flags = *flags | SND_HEAD_CHANNELS;
                demanded->channels = 2;
            }
        } else {
            *flags = *flags | SND_HEAD_CHANNELS;
            if (test_mono(avail))
                demanded->channels = 1;
            else {
                snd_fail("No available channels number (internal error)");
                return(!SND_SUCCESS);
            }
        }
    }

    if (demanded->mode != SND_MODE_PCM){
        *flags = *flags | SND_HEAD_MODE;
        demanded->mode = SND_MODE_PCM;
    }

    return (SND_SUCCESS);
}
Exemplo n.º 8
0
int main(void)
{
        uint32_t result = TC_PASS;

        TC_START("Performing SHA256 tests (NIST tests vectors):");

        result = test_1();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #1 failed.\n");
                goto exitTest;
        }
        result = test_2();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #2 failed.\n");
                goto exitTest;
        }
        result = test_3();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #3 failed.\n");
                goto exitTest;
        }
        result = test_4();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #4 failed.\n");
                goto exitTest;
        }
        result = test_5();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #5 failed.\n");
                goto exitTest;
        }
        result = test_6();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #6 failed.\n");
                goto exitTest;
        }
        result = test_7();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #7 failed.\n");
                goto exitTest;
        }
        result = test_8();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #8 failed.\n");
                goto exitTest;
        }
        result = test_9();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #9 failed.\n");
                goto exitTest;
        }
        result = test_10();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #10 failed.\n");
                goto exitTest;
        }
        result = test_11();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #11 failed.\n");
                goto exitTest;
        }
        result = test_12();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #12 failed.\n");
                goto exitTest;
        }
        result = test_13();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #13 failed.\n");
                goto exitTest;
        }
        result = test_14();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #14 failed.\n");
                goto exitTest;
        }

        TC_PRINT("All SHA256 tests succeeded!\n");

exitTest:
        TC_END_RESULT(result);
        TC_END_REPORT(result);
}