Example #1
0
void run_the_test_code(TestSuite *suite, CgreenTest *spec, TestReporter *reporter) {
    significant_figures_for_assert_double_are(8);
    clear_mocks();

    if (per_test_timeout_defined()) {
        validate_per_test_timeout_value();

        die_in(per_test_timeout_value());
    }

    // for historical reasons the suite can have a setup
    if(has_setup(suite)) {
        (*suite->setup)();
    } else {
        if (spec->context->setup != NULL) {
            run_setup_for(spec);
        }
    }

    run(spec);
    // for historical reasons the suite can have a teardown
    if (has_teardown(suite)) {
        (*suite->teardown)();
    } else {
        if (spec->context->teardown != NULL) {
            run_teardown_for(spec);
        }
    }

    tally_mocks(reporter);
}
Example #2
0
Ensure(CrashExample, will_loop_forever) {
    die_in(1);
    while(0 == 0) { }
}
Ensure time_out_in_only_one_second() {
    die_in(1);
    sleep(10);
}