Exemplo n.º 1
0
int main(void)
{
   
    printf("Initializing all tests. Let's go!\n");
   
	begin_tests();
    
    printf("All tests are over!\n");
    
//    while(1);   /*  idle task   */
}
Exemplo n.º 2
0
int main(int argc, char *argv[]) {
	begin_tests();
	run_test(test_cannot_set_bigger_elements);
	run_test(test_cannot_set_outside_bounds);
	run_test(test_cannot_get_outside_bounds);
	run_test(test_empty_array_does_not_blow_up);
	run_test(test_array_set);
	run_test(test_array_set_backwards);
	run_test(test_array_set_overwrites_old_values);
	run_test(test_array_set_high_num);
	run_test(test_array_get);
	run_test(test_dict_set);
	run_test(test_dict_get);
	run_test(test_dict_lots_of_set);
	finish_tests();

	return 0;
}
Exemplo n.º 3
0
int run_tests(void)
{
    int rv = 0;
    int rvt = 0;

#define PC_CALL(f)      \
    if(!isChild) {      \
        BEGINLOG();     \
        rvt = f;        \
        ENDLOG();       \
        SetEvent(event_child);                          \
        WaitForSingleObject(event_parent, INFINITE);    \
    } else {                                            \
        WaitForSingleObject(event_child, INFINITE);     \
        BEGINLOG();     \
        rvt = f;        \
        ENDLOG();       \
        SetEvent(event_parent);                         \
    }                   \
    rv = (rv | rvt)

#define PCINT_CALL(f)   \
    rvt = f;            \
    rv = (rv | rvt)

    PC_CALL(begin_tests());

    PC_CALL(test_create());

    if(tst_read_write)
        PC_CALL(test_lock_prep());

    PCINT_CALL(testint_lock_excl_beof());

    if(tst_read_write)
        PCINT_CALL(testint_lock_excl_rw_beof());

    if(tst_read_write)
        PCINT_CALL(testint_lock_excl_eeof());

    if(tst_wlock_single)
        PCINT_CALL(testint_waitlock());

    if(tst_wlock_parent && !isChild)
        test_waitlock_parent();

    if(tst_wlock_child && isChild)
        test_waitlock_child();

    if(tst_pause) {
        TCHAR c;
        cout << "\nPress <Return> to continue...";
        cin >> c;
        cout << "\n";
    }

    PCINT_CALL(testint_unlock());

    PCINT_CALL(testint_lock_escalation());

    PC_CALL(end_tests());

#undef PC_CALL
#undef PCINT_CALL

    return rv;
}