TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 230 subscribers
Post #25554 13
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/

https://redd.it/1ulqvza
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Sep 26, 2026Token Sequence Injection & Modern Macros: The Most Game-Changing Compile-Time Feature in C…
  2. Sep 25, 2026myStringStream.str("") Considered Harmful Under C++20 I was recently looking at some (rath…
  3. Sep 20, 2026A clever branch free optimization I'm the developer of memlz which is an extremely fast co…
  4. Sep 15, 2026Inside Boost.PolyCollection https://bannalia.blogspot.com/2026/09/inside-boostpolycollecti…
  5. Sep 11, 2026C++26: Standard Library Hardening Experiments https://www.cppstories.com/2026/hardening-ex…
  6. Sep 11, 2026MSVC C++23: constexpr cmath with LLVM Libc https://devblogs.microsoft.com/cppblog/msvc-c23…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →