test

class TestCase

A test case to be used in a test suite.

Minimal exmaple of defining a test suite with 2 test cases:

Suite variable_name = "suite_name"_suite = []() {
    Case { "Case A" } = [] { ... };
    Case { "Case B" } = [] { ... };
};

void lt::test::expect_unreachable(std::source_location source_location = std::source_location::current())

Fails the test case when gets called.

void lt::test::expect_throw(std::invocable auto invocable, std::source_location source_location = std::source_location::current())

Fails the test case when no exceptions are thrown in invocable.

Todo:

: Check exception type.

void lt::test::expect_eq(Testable auto lhs, Testable auto rhs, std::source_location source_location = std::source_location::current())

Fails the test case when lhs != rhs.

void lt::test::expect_ne(Testable auto lhs, Testable auto rhs, std::source_location source_location = std::source_location::current())

Fails the test case when lhs == rhs.

void lt::test::expect_le(Testable auto lhs, Testable auto rhs, std::source_location source_location = std::source_location::current())

Fails the test case when lhs > rhs.

void lt::test::expect_ge(Testable auto lhs, Testable auto rhs, std::source_location source_location = std::source_location::current())

Fails the test case when lhs < rhs.

void lt::test::expect_true(bool expression, std::source_location source_location = std::source_location::current())

Fails the test case when expression is false.

void lt::test::expect_false(bool expression, std::source_location source_location = std::source_location::current())

Fails the test case when expression is true.

void lt::test::expect_not_nullptr(auto *pointer, std::source_location source_location = std::source_location::current())

Fails the test case when pointer == nullptr.

void lt::test::expect_str_contains(const std::string &string, const std::string &token, std::source_location source_location = std::source_location::current())

Fails the test case when string does not contain token.