示例#1
0
int turn_sock_test(void)
{
    pj_pool_t *pool;
    pj_stun_config stun_cfg;
    int i, rc = 0;

    pool = pj_pool_create(mem, "turntest", 512, 512, NULL);
    rc = create_stun_config(pool, &stun_cfg);
    if (rc != PJ_SUCCESS) {
	pj_pool_release(pool);
	return -2;
    }

    rc = state_progression_test(&stun_cfg);
    if (rc != 0) 
	goto on_return;

    for (i=0; i<=1; ++i) {
	int j;
	for (j=0; j<=1; ++j) {
	    rc = destroy_test(&stun_cfg, i, j);
	    if (rc != 0)
		goto on_return;
	}
    }

on_return:
    destroy_stun_config(&stun_cfg);
    pj_pool_release(pool);
    return rc;
}
示例#2
0
SEXP dieharderCallback(SEXP callback_sexp, SEXP bits_sexp, SEXP testnum_sexp, 
		       SEXP seed_sexp, SEXP psamples_sexp, SEXP tsamples_sexp,
		       SEXP ntuple_sexp, SEXP quiet_sexp, SEXP verbose_sexp) {

    initialize_globals(bits_sexp, seed_sexp, ntuple_sexp,
		       quiet_sexp, verbose_sexp);

    Dtest *test_type = dh_test_types[INTEGER_VALUE(testnum_sexp)];
    Test **test_results = create_test(test_type, INTEGER_VALUE(tsamples_sexp), 
				      INTEGER_VALUE(psamples_sexp));

    global_parsed_callback = parse_and_test_callback(callback_sexp);
    if (global_parsed_callback) {
	PROTECT(global_parsed_callback);
	std_test(test_type, test_results);
	UNPROTECT(1);
    } else {
	result = NULL;
    }
    global_parsed_callback = NULL;

    output(test_type, test_results);
    save_values_for_R(test_type, test_results);
    destroy_test(test_type, test_results);
    gsl_rng_free(rng);
    rng = NULL;
    reset_bit_buffers();

    return result;  	
}
示例#3
0
文件: main.cpp 项目: hxzqlh/workspace
int main(int argc , char** argv) 
{
    if(argc!=2)
    {
        cout << argv[0]  << " so" << endl;
        return 1;
    }
 
    void* test_index = dlopen(argv[1], RTLD_NOW);
    if (!test_index) {
        cerr << "Cannot load library: " << dlerror() << '\n';
        return 1;
    }
 
    dlerror();
   
    create_t* create_test = (create_t*) dlsym(test_index, "create");
    const char* dlsym_error = dlerror();
    if (dlsym_error) {
        cerr << "Cannot load symbol create: " << dlsym_error << '\n';
        return 1;
    }
   
    destroy_t* destroy_test = (destroy_t*) dlsym(test_index, "destroy");
    dlsym_error = dlerror();
    if (dlsym_error) {
        cerr << "Cannot load symbol destroy: " << dlsym_error << '\n';
        return 1;
    }
 
    test_base* c_test = create_test();
 
    c_test->display();
 
    destroy_test(c_test);
 
    dlclose(test_index);
}
static void
run_tests (GtkContainer *parent,
           gboolean      wait_for_realize,
           gboolean      fake_remote)
{
    GtkWidget  *vbox;
    DestroyType t;
    Test       *tests[DESTROY_TYPE_LAST];

    vbox = gtk_vbox_new (TRUE, 2);
    gtk_widget_show (vbox);
    gtk_container_add (parent, vbox);


#if 0
    {   /* Test raw plug / socket */
        GtkWidget *socket;

        g_warning ("Foo Bar. !!!");

        socket = gtk_socket_new ();
        g_signal_connect (G_OBJECT (socket), "realize",
                          G_CALLBACK (realize_cb), NULL);
        gtk_widget_show (GTK_WIDGET (socket));
        gtk_box_pack_start (GTK_BOX (vbox), socket, TRUE, TRUE, 2);
    }
#endif

    printf ("create\n");
    for (t = 0; t < DESTROY_TYPE_LAST; t++) {

        tests [t] = create_test (fake_remote);

        gtk_box_pack_start (
            GTK_BOX (vbox),
            GTK_WIDGET (tests [t]->matecomponent_widget),
            TRUE, TRUE, 2);
    }

    if (wait_for_realize)
        mainloop_for (100);

    printf ("show / hide\n");
    gtk_widget_hide (GTK_WIDGET (parent));

    if (wait_for_realize)
        mainloop_for (100);

    gtk_widget_show (GTK_WIDGET (parent));

    if (wait_for_realize)
        mainloop_for (100);

    printf ("re-add\n");
    g_object_ref (G_OBJECT (vbox));
    gtk_container_remove (parent, vbox);
    gtk_container_add (parent, vbox);

    if (wait_for_realize)
        mainloop_for (100);

    printf ("re-parent\n");
    for (t = 0; t < DESTROY_TYPE_LAST; t++) {

        g_object_ref (tests [t]->matecomponent_widget);
        gtk_container_remove (GTK_CONTAINER (GTK_BOX (vbox)),
                              tests [t]->matecomponent_widget);

        gtk_box_pack_start (
            GTK_BOX (vbox),
            GTK_WIDGET (tests [t]->matecomponent_widget),
            TRUE, TRUE, 2);

        g_object_unref (tests [t]->matecomponent_widget);
    }

    if (wait_for_realize)
        mainloop_for (100);

    printf ("destroy\n");
    for (t = 0; t < DESTROY_TYPE_LAST; t++) {
        destroy_test (tests [t], t);
        mainloop_for (0);
    }

    gtk_widget_destroy (GTK_WIDGET (vbox));
}