Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 824 Bytes

File metadata and controls

51 lines (38 loc) · 824 Bytes

TestCppLite

Purpose

provide a simple, lightweight testing library for C++ without inheritance or macros

Build

$ cmake -S . -B build
$ cmake --build build --target sbash64-testcpplite

Use

#include <sbash64/testcpplite/testcpplite.hpp>

#include <iostream>
#include <string>

using std::literals::string_literals::operator""s;

static void passes(sbash64::testcpplite::TestResult &result) {
    assertEqual(result, 1, 1);
}

static void fails(sbash64::testcpplite::TestResult &result) {
    assertEqual(result, "a"s, "b"s);
}

int main() {
    return sbash64::testcpplite::test(
        {
            {passes, "this test will pass"},
            {fails, "this test will fail"}
        },
        std::cout
    );
}

Output:

failed this test will fail
expected:
"a"
actual:
"b"