Beispiel #1
0
int
main()
{
    cu_init();
    cuflow_wind_gotos();
    printf("Warning: Unless you have set a reasonably low limit to the"
	   "stack size,\nthis test may use extensive resources and "
	   "freeze your machine for\nsome time.\n\n"
	   "Are you sure you want to run the test now? (type \"yes\" to run) ");
    fflush(stdout);
    if (fgetc(stdin) != 'y' || fgetc(stdin) != 'e' || fgetc(stdin) != 's' ||
	fgetc(stdin) != '\n')
	return 0;
    printf("Doing infinite recursive call.\n");
    test();
    fprintf(stderr, "Hmmm, no infinite recursion?\n");
    return 1;

unwind:
rewind:
    abort();
except:
    fprintf(stderr, "Stack overflow detected.\n");
    return 0;
}
Beispiel #2
0
int
main()
{
    cu_init();
    _bench();
    return 2*!!cu_test_bug_count();
}
Beispiel #3
0
int
main(int argc, char **argv)
{
    cu_init();
    test(argc >= 2? atoi(argv[1]) : N_ALLOC);
    return 2*!!cu_test_bug_count();
}
Beispiel #4
0
int
main()
{
    int sizew;
    cu_word_t arr[8];

    cu_init();
    for (sizew = 1; sizew <= 8; ++sizew) {
	int N = 40000000 / (1 + (sizew - 1)/3);
	int i;
	clock_t t_arr, t_arr_noinit;

	t_arr = -clock();
	for (i = 0; i < N; ++i)
	    cu_wordarr_hash_bj(sizew, arr, 0);
	t_arr += clock();

	t_arr_noinit = -clock();
	for (i = 0; i < N; ++i)
	    cu_wordarr_hash_noinit_bj(sizew, arr);
	t_arr_noinit += clock();

	printf("%3d %12lg%12lg", sizew, clockavg(t_arr, N), clockavg(t_arr_noinit, N));

	if (sizew == 1) {
	    clock_t t_1w, t_1w_noinit;

	    t_1w = -clock();
	    for (i = 0; i < N; ++i)
		cu_1word_hash_bj(arr[0], 0);
	    t_1w += clock();

	    t_1w_noinit = -clock();
	    for (i = 0; i < N; ++i)
		cu_1word_hash_noinit_bj(arr[0]);
	    t_1w_noinit += clock();

	    printf("%12lg%12lg", clockavg(t_1w, N), clockavg(t_1w_noinit, N));
	} else if (sizew == 2) {
	    clock_t t_2w, t_2w_noinit;

	    t_2w = -clock();
	    for (i = 0; i < N; ++i)
		cu_2word_hash_bj(arr[0], arr[1], 0);
	    t_2w += clock();

	    t_2w_noinit = -clock();
	    for (i = 0; i < N; ++i)
		cu_2word_hash_noinit_bj(arr[0], arr[1]);
	    t_2w_noinit += clock();

	    printf("%12lg%12lg", clockavg(t_2w, N), clockavg(t_2w_noinit, N));
	}
	fputc('\n', stdout);
    }
    return 2*!!cu_test_bug_count();
}
Beispiel #5
0
int
main()
{
    int j;
    cu_init();
    for (j = 0; j < 22; ++j)
	profile(1 << j);
    return 0;
}
Beispiel #6
0
int
main()
{
    cu_init();
    _the_const_type = cuoo_type_new_opaque_hcs(
	cuoo_impl_none, sizeof(struct _const) - CUOO_HCOBJ_SHIFT);
    _the_tuple1_type = cuoo_type_new_opaque_hcs(
	cuoo_impl_none, sizeof(struct _tuple1) - CUOO_HCOBJ_SHIFT);
    _the_tuple2_type = cuoo_type_new_opaque_hcs(
	cuoo_impl_none, sizeof(struct _tuple2) - CUOO_HCOBJ_SHIFT);
    _the_tuple3_type = cuoo_type_new_opaque_hcs(
	cuoo_impl_none, sizeof(struct _tuple3) - CUOO_HCOBJ_SHIFT);
    _test();
    return 2*!!cu_test_bug_count();
}
Beispiel #7
0
int
main()
{
    cu_init();
    TEST_BOX(int, 0);
    TEST_BOX(int, INT_MIN);
    TEST_BOX(int, INT_MAX);
    TEST_BOX(int, 0x5566aabb);
    TEST_BOX(uint, 0);
    TEST_BOX(uint, UINT_MAX);
    TEST_BOX(uint, 0xaabb5566);
    TEST_BOX(float, (float)M_PI);
    TEST_BOX(double, M_PI);
    TEST_BOX(longdouble, (long double)M_PI);
    return 2*!!cu_test_bug_count();
}
Beispiel #8
0
int UpdateMain(void)
{
	CUCtrl win;
	LXml *custom;
	
#ifdef _WIN32
	WSADATA wsaData;
	WSAStartup(0x0202,&wsaData);
#endif
	cu_init();
	custom=l_xml_load((const char*)config_update);
	win=cu_ctrl_new(NULL,custom->root.child);
	cu_ctrl_show_self(win,1);
	cu_loop();
	cu_ctrl_free(win);
	l_xml_free(custom);
	return 0;
}
Beispiel #9
0
void
cuflow_init()
{
    static int done_init = 0;
    if (done_init)
	return;
    done_init = 1;

    cu_init();
    cuflowP_signal_init();
    cuflowP_gworkq_init();
    cuflowP_tstate_init();
    cuflowP_cdisj_init();
    cuflowP_workers_init();
    cuflowP_sched_init();	/* after: cuflowP_workers_init */
#ifdef CUCONF_ENABLE_EXPERIMENTAL
    cuflowP_time_init();
    cuflowP_cntn_common_init();
    cuflowP_wheel_init();	/* after: cuflowP_workers_init */
    cuflowP_cached_init();
#endif
}
Beispiel #10
0
int
main()
{
    cu_init();

    test_path("", NULL);
    test_path("/", "/");
    test_path(".", ".");
    test_path("./", ".");
    test_path("/.", "/");
    test_path("..", "..");
    test_path("../", "..");
    test_path("/..", NULL);
    test_path("../..", "../..");
    test_path(".//./", ".");
    test_path("..///.", "..");
    test_path("../..///", "../..");
    test_path("a", "a");
    test_path("a/", "a");
    test_path("/a", "/a");
    test_path("./a", "a");
    test_path("././a/.", "a");
    test_path("a/b", "a/b");
    test_path("/a/b/", "/a/b");
    test_path("//a//b//.", "/a/b");
    test_path("a/./b/./../.", "a");
    test_path("a/b/../..", ".");
    test_path("a/b/..//../../..", "../..");
    test_path("a/.././b", "b");
    test_path("a/../../b/..", "..");
    test_path("bla/blaa/", "bla/blaa");
    test_path("bla/blaa//", "bla/blaa");
    test_path("/bla", "/bla");
    test_path("//bla", "/bla");
    test_path("test/./bla", "test/bla");
    test_path("test/../bla", "bla");
    test_path("test/../../bla", "../bla");
    test_path("test/../../bla/be/../../..", "../..");
    test_split_join();

    test_join(".", "..", "..");
    test_join("a/b", "..", "a");
    test_join("a/b", "../..", ".");
    test_join("a/b", "../../..", "..");
    test_join("../a", "..", "..");
    test_join("../a", "../..", "../..");
    test_join(".", ".", ".");

    test_split("/", 0, ".", "/");
    test_split("/", 1, "/", ".");
    test_split(".", 0, ".", ".");
    test_split("a", 0, ".", "a");
    test_split("a", 1, "a", ".");
    test_split("a", -1, ".", "a");
    test_split("/a", 0, ".", "/a");
    test_split("/a", 1, "/", "a");
    test_split("/a", 2, "/a", ".");
    test_split("/a", -1, "/", "a");
    test_split("/a", -2, ".", "/a");
    test_split("../vu", 0, ".", "../vu");
    test_split("../vu", 1, "..", "vu");
    test_split("../vu", 2, "../vu", ".");
    test_split("../vu", -1, "..", "vu");
    test_split("../vu", -2, ".", "../vu");

    test_depth(".", 0, 0);
    test_depth("/", 1, 1);
    test_depth("a", 1, 1);
    test_depth("a/b", 2, 2);
    test_depth("..", -1, 1);
    test_depth("../..", -2, 2);
    test_depth("../a/b", 1, 3);
    test_depth("/al", 2, 2);

    return errors != 0;
}