Testing code that depends on system time is challenging because you can't control what `std::chrono::system_clock::now()` returns. Three approaches solve this: inheritance-based clock wrappers (using polymorphism with `Clock` interface), concept-based solutions (using C++20 concepts to constrain clock-like types), and time

6m read timeFrom sandordargo.com
Post cover image
Table of contents
The problem of time and testingA hiearchy of clocksUse the trait, use conceptsA time provider lambdaWhich one to choose?ConclusionConnect deeper

Sort: