Esempio 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);
}
Esempio n. 2
0
Ensure parameter_name_gives_true_if_matching() {
    Constraint *any_old_want = want(label, 37);
    assert_equal(is_constraint_parameter(any_old_want, "wrong_label"), 0);
    assert_equal(is_constraint_parameter(any_old_want, "label"), 1);
    destroy_constraint(any_old_want);
}
Esempio n. 3
0
Ensure unequal_doubles_compare_false_with_a_want_double_constraint() {
    Constraint *want_37 = want_double(label, 37.0);
    assert_equal(compare_constraint(want_37, box_double(36.0)), 0);
    destroy_constraint(want_37);
}
Esempio n. 4
0
Ensure can_construct_and_destroy_an_want_constraint() {
    Constraint *any_old_want = want(label, 37);
    destroy_constraint(any_old_want);
}
Esempio n. 5
0
Ensure can_expect_null_strings_as_well_as_real_ones() {
    Constraint *want_hello = want_string(label, NULL);
    assert_equal(compare_constraint(want_hello, NULL), 1);
    assert_equal(compare_constraint(want_hello, "Hello"), 0);
    destroy_constraint(want_hello);
}
Esempio n. 6
0
Ensure can_compare_strings_as_equal() {
    Constraint *want_hello = want_string(label, "Hello");
    assert_equal(compare_constraint(want_hello, "Hello"), 1);
    assert_equal(compare_constraint(want_hello, "Goodbye"), 0);
    destroy_constraint(want_hello);
}
Esempio n. 7
0
Ensure can_construct_and_destroy_a_want_string_constraint() {
    Constraint *any_old_string_want = want_string(label, "Hello");
    destroy_constraint(any_old_string_want);
}
Esempio n. 8
0
Ensure equal_pointers_compare_true_with_a_want_constraint() {
    Constraint *want_pointed_at_37 = want(label, (void *)37);
    assert_equal(compare_constraint(want_pointed_at_37, (void *)37), 1);
    assert_equal(compare_constraint(want_pointed_at_37, (void *)36), 0);
    destroy_constraint(want_pointed_at_37);
}
Esempio n. 9
0
Ensure equal_integers_compare_true_with_a_want_constraint() {
    Constraint *want_37 = want(label, 37);
    assert_equal(compare_constraint(want_37, 37), 1);
    destroy_constraint(want_37);
}
Esempio n. 10
0
void destroy_constraints(va_list constraints) {
    Constraint *constraint = NULL;
    while ((constraint = va_arg(constraints, Constraint *)) != (Constraint *)0) {
        destroy_constraint(constraint); 
    }
}