Ejemplo n.º 1
0
Ensure constraints_on_doubles_respect_significant_figure_setting() {
	significant_figures_for_assert_double_are(2);
    Constraint *want_337 = want_double(label, 337.0);
    assert_equal(compare_constraint(want_337, box_double(339.0)), 1);
	significant_figures_for_assert_double_are(3);
    assert_equal(compare_constraint(want_337, box_double(339.0)), 0);
    destroy_constraint(want_337);
}
Ejemplo n.º 2
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);
}
Ejemplo n.º 3
0
static void run_the_test_code(TestSuite *suite, UnitTest *test, TestReporter *reporter) {
    significant_figures_for_assert_double_are(8);
    clear_mocks();
	(*suite->setup)();
    (*test->test)();
	(*suite->teardown)();
	tally_mocks(reporter);
}
Ejemplo n.º 4
0
Ensure double_assertions_can_have_custom_messages() {
	significant_figures_for_assert_double_are(3);
	assert_double_equal_with_message(1.113, 1.115, "This should pass");
}
Ejemplo n.º 5
0
Ensure double_differences_matter_past_significant_figures() {
	significant_figures_for_assert_double_are(4);
	assert_double_not_equal(1.113, 1.115);
	assert_double_not_equal(1113, 1115);
	assert_double_not_equal(1113000, 1115000);
}