Beispiel #1
0
int test_function_set_new_and_destroy(void)
{
    int i;

    setup_function_set();
    mu_check(fs != NULL);

    for (i = 0; i < 9; i++) {
        mu_print("function number: %d\t", fs->functions[i]->function);
        mu_print("arity: %d\n", fs->functions[i]->arity);
    }

    teardown_function_set();
    return 0;
}
Beispiel #2
0
int main(int argc, char* argv[]) {

	parse_args(argc, argv);

	mu_run_suites();

  // Clean up OpenSSL junk
  ERR_remove_state(0);
  ERR_free_strings();
  EVP_cleanup();
  CRYPTO_cleanup_all_ex_data();

	mu_print(MU_SUMMARY, "\n"
			"Tests done:\n"
			"\t%d test suite(s) passed, %d failed, %d skipped.\n"
			"\t%d test case(s) passed, %d failed.\n"
			"\t%d check(s) passed, %d failed.\n"
			"\n",
			mutest_passed_suites, mutest_failed_suites,
			mutest_skipped_suites,
			mutest_passed_cases, mutest_failed_cases,
			mutest_passed_checks, mutest_failed_checks);

	return (mutest_failed_suites + mutest_skipped_suites) ? 1 : 0;
}
Beispiel #3
0
int test_point_crossover(void)
{
    int i;
    struct test *t;
    struct tree *t1;
    struct tree *t2;
    char *t1_before;
    char *t2_before;
    char *t1_after;
    char *t2_after;

    /* setup */
    t = malloc(sizeof(struct test));
    test_setup_function_set(t);
    test_setup_terminal_set(t);

    for (i = 0; i < 1; i++) {
        /* generate tree 1 and 2 */
        t1 = tree_generate(FULL, t->fs, t->ts, 1);
        t2 = tree_generate(FULL, t->fs, t->ts, 1);

        /* before crossover */
        mu_print("BEFORE:\n");
        t1_before = tree_string(t1);
        t2_before = tree_string(t2);
        mu_print("t1 tree: %s\n", t1_before);
        mu_print("t2 tree: %s\n", t2_before);
        mu_print("t1 size: %d depth %d\n", t1->size, t1->depth);
        mu_print("t2 size: %d depth %d\n", t2->size, t2->depth);

        /* crossover */
        point_crossover(t1, t2);

        /* after crossover */
        mu_print("AFTER:\n");
        t1_after = tree_string(t1);
        t2_after = tree_string(t2);
        mu_print("t1 tree: %s\n", t1_after);
        mu_print("t2 tree: %s\n", t2_after);
        mu_print("t1 size: %d depth %d\n", t1->size, t1->depth);
        mu_print("t2 size: %d depth %d\n", t2->size, t2->depth);
        mu_print("\n");

        /* clean up */
        tree_destroy(t1);
        tree_destroy(t2);
        free(t1_before);
        free(t2_before);
        free(t1_after);
        free(t2_after);
    }

    /* clean up */
    test_teardown_function_set(t);
    test_teardown_terminal_set(t);
    free(t);

    return 0;
}
Beispiel #4
0
int test_point_crossover(void)
{
    int i;
    char *t1_before;
    char *t2_before;
    char *t1_after;
    char *t2_after;

    for (i = 0; i < 1; i++) {
        setup();
        mu_print("BEFORE:\n");
        t1_before = tree_string(t1);
        t2_before = tree_string(t2);
        mu_print("t1 tree: %s\n", t1_before);
        mu_print("t2 tree: %s\n", t2_before);
        mu_print("t1 size: %d depth %d\n", t1->size, t1->depth);
        mu_print("t2 size: %d depth %d\n", t2->size, t2->depth);


        point_crossover(t1, t2);

        mu_print("AFTER:\n");
        t1_after = tree_string(t1);
        t2_after = tree_string(t2);
        mu_print("t1 tree: %s\n", t1_after);
        mu_print("t2 tree: %s\n", t2_after);
        mu_print("t1 size: %d depth %d\n", t1->size, t1->depth);
        mu_print("t2 size: %d depth %d\n", t2->size, t2->depth);
        mu_print("\n");

        teardown();
        free(t1_before);
        free(t2_before);
        free(t1_after);
        free(t2_after);
    }

    setup();
    mu_print("BEFORE:\n");
    tree_print(t1);
    tree_print(t2);
    point_crossover(t1, t2);
    mu_print("AFTER:\n");
    tree_print(t1);
    tree_print(t2);

    mu_print("\n\nBEFORE:\n");
    tree_print(t1);
    tree_print(t2);
    point_crossover(t1, t2);
    mu_print("AFTER:\n");
    tree_print(t1);
    tree_print(t2);
    teardown();

    return 0;
}