コード例 #1
0
ファイル: CFCTest.c プロジェクト: leckie711/lucy-clownfish
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);
}
コード例 #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;
}
コード例 #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;
}
コード例 #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;
}
コード例 #5
0
ファイル: CFCTest.c プロジェクト: leckie711/lucy-clownfish
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);
    }
}
コード例 #6
0
ファイル: CFCTest.c プロジェクト: leckie711/lucy-clownfish
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);
    }
}
コード例 #7
0
bool
TestBatchRunner_VFail_IMP(TestBatchRunner *self, const char *pattern,
                          va_list args) {
    return S_vtest_true(self, false, pattern, args);
}
コード例 #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);
}