Repository navigation
liblittletest v2.1.0 adds four small testing features while retaining the C++11, standard-library-only, single-header design. Existing documented macros and no-argument test execution remain supported.
Richer failure diagnostics and messages
Boolean failures show their source expression; comparisons show operand expressions and actual values. Types without stream insertion display <unprintable> instead of preventing compilation.
LT_CHECK_MSG(record.valid(), "while parsing record 42");Message expressions are evaluated only on failure. LT_WARN_MSG and LT_ASSERT_MSG follow their usual severity behavior.
List and filter tests
Both manual and automatic environments support:
./tests --list
./tests --filter "parser*"
./tests --list --filter="parser?"Patterns match the entire test name, are case-sensitive, and support * and ?. A filter matching no tests fails clearly. Listing prints registered namespace-scope test names and exits before fixtures or the environment body. Manual execution still respects the runner's explicit selection and order.
Expected exception types
LT_CHECK_THROW_AS(parse(input), std::invalid_argument);Normal C++ catch matching applies, including derived-to-base matches and non-class exceptions. Missing and unexpected exceptions are reported separately. Warning and assertion variants are also available.
Explicit-tolerance near comparisons
LT_CHECK_NEAR(actual, expected, 0.001);Near checks use a finite, nonnegative absolute tolerance and evaluate actual, expected, and tolerance once in that order. Arithmetic values are compared using long double precision. NaNs fail; equal same-sign infinities pass; unequal infinities fail. Warning and assertion variants are available.
Download and verification
Download the attached littletest.hpp; the full MIT notice is embedded in the header. LT_VERSION is 2.1 and LT_VERSION_STRING is "2.1.0".
The regression suite now includes 62 tests, with CI for GCC and Clang in C++11/C++20 modes and sanitizers. Windows remains unverified.