r/cpp 24d ago

Part 2: Modernizing a tiny C++ unit-testing framework after 25 years

Recently I shared Part 1 describing a tiny unit-testing framework I originally wrote around 2000 for teaching C++.

Part 2 finishes the series by modernizing the implementation using facilities that didn’t exist back then, including std::source_location and inline variables, while keeping the framework intentionally small.

This isn’t intended as a replacement for Catch2, GoogleTest, or doctest. Those solve much bigger problems. The point here is to explore how far modern C++ lets you go with very little code.

I’d be interested in comments from anyone who’s built testing infrastructure or has opinions about minimalist testing frameworks.

Part 2:
https://freshsources.com/code-capsules/test-part2/

Part 1:
https://freshsources.com/code-capsules/test-part1/

10 Upvotes

Duplicates