Skip to content

eggs-cpp/test

Repository files navigation

eggs.test

A minimal, header-only C++ test framework. Requires C++23.

Usage

#include <eggs/test.hpp>

TEST_CASE(my_test, "adds two integers") {
    CHECK(1 + 1 == 2);
    REQUIRE(1 + 1 == 2);  // stops the test case on failure
}

int main() {
    return eggs::test::run();
}

CHECK(expr) — reports failure and continues.
REQUIRE(expr) — reports failure and stops the current test case.
Both print a stacktrace when called from a helper function.

Build

cmake --preset dev-gcc        # or dev-clang, dev-clang-libcxx, dev-msvc
cmake --build --preset dev-gcc-debug
ctest --preset dev-gcc-debug

See CMakePresets.json for the full list of presets (GCC, Clang, Clang+libc++, MSVC, ASan, TSan).

CMake integration

find_package(eggs.test REQUIRED)
target_link_libraries(my_tests PRIVATE Eggs::Test Eggs::TestMain)

License

See LICENSE.txt.

About

Eggs.Test is a C++23 test library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors