Exemple #1
0
intptr_t _mock(const char *function, const char *parameters, ...) {
    unwanted_check(function);
    RecordedExpectation *expectation = find_expectation(function);
    if (expectation != NULL) {
        Vector *names = create_vector_of_names(parameters);
        int i;
        va_list actual;
        va_start(actual, parameters);
        for (i = 0; i < vector_size(names); i++) {
            apply_any_constraints(expectation, vector_get(names, i), va_arg(actual, intptr_t));
        }
        va_end(actual);
        destroy_vector(names);
    }
    return stubbed_result(function);
}
Exemple #2
0
intptr_t mock_(const char *function, const char *parameters, ...) {
    RecordedExpectation *expectation = NULL;
    unwanted_check(function);
    expectation = find_expectation(function);
    if (expectation != NULL) {
        CgreenVector *names = create_vector_of_names(parameters);
        int i;
        va_list actual;
        va_start(actual, parameters);
        for (i = 0; i < cgreen_vector_size(names); i++) {
            apply_any_constraints(expectation, (const char *)cgreen_vector_get(names, i), va_arg(actual, intptr_t));
        }
        va_end(actual);
        destroy_cgreen_vector(names);
        if (! expectation->should_keep) {
            destroy_expectation(expectation);
        }
    }
    return stubbed_result(function);
}