Example #1
0
int
main()
{
  gsl_rng *r = gsl_rng_alloc(gsl_rng_default);
  size_t n;

  test_poisson(7, 1.0e-1, 0);
  test_poisson(7, 1.0e-1, 1);

  test_poisson(543, 1.0e-5, 0);
  test_poisson(543, 1.0e-5, 1);

  test_poisson(1000, 1.0e-6, 0);
  test_poisson(1000, 1.0e-6, 1);

  test_poisson(5000, 1.0e-7, 0);
  test_poisson(5000, 1.0e-7, 1);

  test_toeplitz(15, 0.01, 1.0, 0.01);
  test_toeplitz(15, 1.0, 1.0, 0.01);
  test_toeplitz(50, 1.0, 2.0, 0.01);
  test_toeplitz(1000, 0.5, 1.0, 0.01);

  for (n = 1; n <= 100; ++n)
    {
      test_random(n, r, 0);
      test_random(n, r, 1);
    }

  gsl_rng_free(r);

  exit (gsl_test_summary());
} /* main() */
Example #2
0
int main(void)
{
	int ret = 0;

	setlinebuf(stdout);

	ret |= test_random(100,   500000);
	ret |= test_random(2000,  10000);
	ret |= test_random(8000,  1000);

	return ret;
}
Example #3
0
int
main (int argc, char *argv[])
{
    if (argc < 2) {
	printf("Usage %s <string to encode>\n", argv[0]);
	return (1);
    }

    if ((test_sizes()) != 0) {
	return (1);
    }

    if ((test_string(argv[1], strlen(argv[1]))) != 0) {
	return (1);
    }

    if (test_uuid() != 0) {
	return (1);
    }

    if (test_random() != 0) {
	return (1);
    }

    return (0);
}
Example #4
0
int main()
{
    test_trim();
    test_toupper_tolower();
    test_compare_icase();
    test_sstream();
    test_prefix_suffix();
    test_replace();
    test_split_ws();
    test_split();
    test_join();
    test_contains();
    test_extract_between();
    test_random();
    test_hexdump();
    test_base64();
    test_uri_decode();
    test_levenshtein();

#if HAVE_OPENSSL
    test_crypto_digest();
#endif

    return 0;
}
int main(void) {

    test_vector();
    test_base();
    test_scalarmult();
    test_random();
    _exit(0);
}
Example #6
0
int main(int argc, char *argv[])
{
	test_frames();
	test_stringf();
	test_random();
	test_datetime();
	return 0;
}
Example #7
0
int main(){
  srand(time(NULL));
  test_ascending();
  test_descending();
  test_random();
  printf("Ok!\n");
  return 0;
}
int main(void) {

    test_precomp();
    test_random();
    test_signopen();

    _exit(0);
}
Example #9
0
void test_suite(int argc, const char *argv[]) {
    long num_tests = 1;
    FILE *score_file = stdout;
    FILE *tile_file = stdout;
    if (argc > 1) {
        // First argument should be number of trials
        num_tests = strtol(argv[1], NULL, 10);
        if (argc > 2) {
            const char *score_filename = argv[2];
            if ((score_file = fopen(score_filename, "w")) == NULL) {
                printf("Error: Could not open score file\n");
                exit(1);
            }
            if (argc > 3) {
                const char *score_filename = argv[3];
                if ((tile_file = fopen(score_filename, "w")) == NULL) {
                    printf("Error: Could not open max tile file\n");
                    exit(1);
                }
            }
        }
    }
    const char *f_labels = "Squaresum,Empty Blocks,Sequential Weight,Weighted Row/Col,Optimized";
    Heuristic h_functions[] = {
        squaresum_heuristic,
        empty_blocks,
        weighted_sum1,
        weighted_sum2,
        optimized_heuristic
    };
    int num_funcs = 5;
    int scores[num_funcs+1][num_tests];
    int mtiles[num_funcs+1][num_tests];

    for (int i=0; i < num_tests; i++) {
        test_random(&scores[0][i], &mtiles[0][i]);
        for (int h=0; h<num_funcs; h++) {
            test_minimax(h_functions[h], &scores[1+h][i], &mtiles[1+h][i]);
        }
    }

    fprintf(score_file, "Baseline,%s\n", f_labels);
    for (int i=0; i < num_tests; i++) {
        for (int j=0; j < num_funcs + 1; j++) {
            fprintf(score_file, "%d%s", scores[j][i], (j==num_funcs)?"\n":",");
        }
    }
    printf("\n");

    fprintf(tile_file, "Baseline,%s\n", f_labels);
    for (int i=0; i < num_tests; i++) {
        for (int j=0; j < num_funcs + 1; j++) {
            fprintf(tile_file, "%d%s", mtiles[j][i], (j==num_funcs)?"\n":",");
        }
    }
    printf("\n");
}
Example #10
0
int main () {
  START("CoolRandom");
  test_random();
#if LEAK
  test_leak();
#endif
  SUMMARY();
  return 0;
}
Example #11
0
int atom_test(void)
{
  error   err;
  atom_set_t *d;

  d = atom_create_tuned(1, 12);
  if (d == NULL)
    return 1;

  err = test_add(d);
  if (err)
    return 1;

  err = test_to_string(d);
  if (err)
    return 1;

  err = test_to_string_and_len(d);
  if (err)
    return 1;

  err = test_delete(d);
  if (err)
    return 1;

  err = test_to_string_and_len(d);
  if (err)
    return 1;

  err = test_add(d);
  if (err)
    return 1;

  err = test_to_string(d);
  if (err)
    return 1;

  err = test_rename(d);
  if (err)
    return 1;

  err = test_to_string(d);
  if (err)
    return 1;

  err = test_to_string_and_len(d);
  if (err)
    return 1;

  err = test_random(d);
  if (err)
    return 1;

  atom_destroy(d);

  return 0;
}
Example #12
0
int test_all()
{
	int result = 0;
	result += test_random();
	result += test_linked_list();
	result += test_vstack();
	result += test_vqueue();
	result += test_sort();
	/* result += test_hash(); HASH IS NOT COMPLETE */
	return result;
}
Example #13
0
int aim_main(int argc, char* argv[])
{
    (void) argc;
    (void) argv;

    test_basic();
    test_collisions();
    test_random();
    test_mask();

    return 0;
}
Example #14
0
int main()
{
	if (test_replace()==0 && test_replace_any()==0 &&
	test_trim_left()==0 && test_trim_right()==0 && test_trim()==0 &&
	test_str2hex()==0 &&
	test_split()==0 && test_split_first()==0 && test_split_second()==0 &&
	test_vexec()==0 &&
	test_json_set()==0 &&
	test_hash()==0 &&
	test_random()==0 &&
	test_local()==0
	)
	{
		std::cout << "Success" << std::endl;
		return EXIT_SUCCESS;
	} else {
		std::cerr << "Fail" << std::endl;
		return EXIT_FAILURE;
	}
}
Example #15
0
void test_leak() {
  for (;;) {
    test_random();
  }
}
Example #16
0
 // Perform the test
 virtual void test()
 {
     // Start tests
     test_random();
 }
void test_utils() {
    test_angle_diff();
    test_nearest_int();
    test_random();
}
Example #18
0
int main()
{
	test_manual();
	test_random();
	return 0;
}
Example #19
0
int main() {

	return test_random();
}
int main(int argc, char* argv[])
{
    signal(SIGINT, sigint_handler);
#if !defined(NDEBUG)
    std::cout << "!!!!!! DEBUG ENABLED !!!!!!" << std::endl;
#endif

#if defined(OPENMP_FOUND)
    omp_set_nested(true);
    std::cout << "!!!!!! OPENMP FTW !!!!!!" << std::endl;
    std::cout << omp_get_max_threads() << " threads max" << std::endl;
    std::cout << omp_get_wtick()*1e9 << "ns tick" << std::endl;
    assert( omp_get_nested() );
#endif

    test_random();
    Rng rng;
    rng.seed(rand());

    Options options = parse_options(argc, argv);

    std::cout << "uct constant " << options.uct_constant << std::endl;
    std::cout << "max mc depth " << options.max_mc_depth << std::endl;

    typedef std::map<std::string, int> Wins;
    Wins wins;

    for (int kk=0; kk<options.number_of_games; kk++)
    {
        std::cout << std::endl << std::endl;
        std::cout << "****************************************" << std::endl;
        std::cout << "game " << kk << "/" << options.number_of_games << std::endl;

        const Game& game = play_game(options, rng);

        const int winner = game.state.get_winner();
        if (winner < 0) wins["draw"]++;
        else {
            std::string winner_name = "bot";
            if (game.hero_infos[winner].is_real_bot())
                winner_name = game.hero_infos[winner].name;
            wins[winner_name]++;
        }

        std::cout << std::endl;
        std::cout << "after " << options.number_of_games << " games" << std::endl;
        for (Wins::const_iterator wi=wins.begin(), wie=wins.end(); wi!=wie; wi++)
        {
            if (wi->first == "draw")
            {
                std::cout << "  " << wi->second << " draw" << std::endl;
                continue;
            }
            std::cout << "  " << wi->second << " victory for " << wi->first << std::endl;
        }

        if (sigint_already_caught) break;
    }

    return 0;
}