Exemplo n.º 1
0
void
CFCTest_test_true(CFCTest *self, int cond, const char *fmt, ...) {
    va_list args;
    va_start(args, fmt);
    S_vtest_true(self, cond, fmt, args);
    va_end(args);
}
Exemplo n.º 2
0
bool
TestBatchRunner_VTest_String_Equals_IMP(TestBatchRunner *self, const char *got,
                                        const char *expected,
                                        const char *pattern, va_list args) {
    bool pass = (strcmp(got, expected) == 0);
    S_vtest_true(self, pass, pattern, args);
    if (!pass) {
        TestFormatter_test_comment(self->formatter,
                                   "Expected '%s', got '%s'.\n",
                                   expected, got);
    }
    return pass;
}
Exemplo n.º 3
0
bool
TestBatchRunner_VTest_UInt_Equals_IMP(TestBatchRunner *self, uint64_t got,
                                      uint64_t expected, const char *pattern,
                                      va_list args) {
    bool pass = (got == expected);
    S_vtest_true(self, pass, pattern, args);
    if (!pass) {
        TestFormatter_test_comment(self->formatter,
                                   "Expected '%"PRIu64"', got '%"PRIu64"'.\n",
                                   expected, got);
    }
    return pass;
}
Exemplo n.º 4
0
bool
TestBatchRunner_VTest_Float_Equals_IMP(TestBatchRunner *self, double got,
                                       double expected, const char *pattern,
                                       va_list args) {
    double relative_error = got / expected - 1.0;
    bool   pass           = (fabs(relative_error) < 1e-6);
    S_vtest_true(self, pass, pattern, args);
    if (!pass) {
        TestFormatter_test_comment(self->formatter,
                                   "Expected '%e', got '%e'.\n",
                                   expected, got);
    }
    return pass;
}
Exemplo n.º 5
0
void
CFCTest_test_string_equals(CFCTest *self, const char *result,
                           const char *expected, const char *fmt, ...) {
    int cond = (strcmp(result, expected) == 0);

    va_list args;
    va_start(args, fmt);
    S_vtest_true(self, cond, fmt, args);
    va_end(args);

    if (!cond) {
        self->formatter->test_comment("Expected '%s', got '%s'.\n",
                                      expected, result);
    }
}
Exemplo n.º 6
0
void
CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected,
                        const char *fmt, ...) {
    int cond = (result == expected);

    va_list args;
    va_start(args, fmt);
    S_vtest_true(self, cond, fmt, args);
    va_end(args);

    if (!cond) {
        self->formatter->test_comment("Expected '%"PRIu64"',"
                                      " got '%"PRIu64"'.\n",
                                      expected, result);
    }
}
Exemplo n.º 7
0
bool
TestBatchRunner_VFail_IMP(TestBatchRunner *self, const char *pattern,
                          va_list args) {
    return S_vtest_true(self, false, pattern, args);
}
Exemplo n.º 8
0
bool
TestBatchRunner_VTest_False_IMP(TestBatchRunner *self, bool condition,
                                const char *pattern, va_list args) {
    return S_vtest_true(self, !condition, pattern, args);
}