dot-xx
A personal collection of small C++ modules
Loading...
Searching...
No Matches
dxx.selftest Module Reference

Unit testing. See dxx::selftest::run_all for usage help. More...

Classes

class  dxx::selftest::UnitTest< TFunc >
 Create an object of that class to declare a unit test. More...
struct  dxx::selftest::test_failure
 The exception type used by test assertions. More...
class  dxx::selftest::LifetimeTester
 A simple class for tracking object moves/copies during their lives in containers. More...

Typedefs

using dxx::selftest::TestBody = std::function<void()>
using dxx::selftest::TestsMap = std::map<std::string, TestBody>

Functions

void dxx::selftest::test (bool condition, std::source_location st=std::source_location::current())
 Test assertion. Calls dxx::assert::always with test_failure.
int dxx::selftest::run_all (const std::unordered_set< std::string > &filters={})
 Run all tests that match a filter.

Variables

constinit std::unique_ptr< TestsMap > dxx::selftest::all_tests = nullptr
 Storage for all unit tests.

Detailed Description

Unit testing. See dxx::selftest::run_all for usage help.

Files

file  /build-llvm-libcpp/_deps/dot-xx-selftest-src/src/selftest.xx
 Main interface file for dxx::selftest module.
file  /build-llvm-libcpp/_deps/dot-xx-selftest-src/src/lifetime_tester.xx
 A class for testing and tracking object lifetimes.
file  /build-llvm-libcpp/_deps/dot-xx-selftest-src/src/name_deduce.xx
 Unit test name deduction from callable type name.