Example #1
0
void apply_any_constraints(RecordedExpectation *expectation, const char *parameter, intptr_t actual) {
    int i;
    for (i = 0; i < cgreen_vector_size(expectation->constraints); i++) {
        Constraint *constraint = (Constraint *)cgreen_vector_get(expectation->constraints, i);
        if (is_constraint_parameter(constraint, parameter)) {
			switch(constraint->constraint_type)
			{
			case CG_CONSTRAINT_WANT:
				test_constraint(
						constraint,
						expectation->function,
						actual,
						expectation->test_file,
						expectation->test_line,
						get_test_reporter());
			break;
			case CG_CONSTRAINT_SET:
				*((int *)actual) = (int)constraint->out_value;
				break;

			case CG_CONSTRAINT_FILL:
				memcpy((void *)actual, (void *)constraint->out_value, constraint->copy_size);
				break;
			}
        }
    }
}
Example #2
0
void apply_any_constraints(RecordedExpectation *expectation, const char *parameter, intptr_t actual) {
    int i;
    for (i = 0; i < vector_size(expectation->constraints); i++) {
        Constraint *constraint = (Constraint *)vector_get(expectation->constraints, i);
        if (is_constraint_parameter(constraint, parameter)) {
            test_constraint(
                    constraint,
                    expectation->function,
                    actual,
                    expectation->test_file,
                    expectation->test_line,
                    get_test_reporter());
        }
    }
}
Example #3
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);
}