Hacker News new | ask | show | jobs
C++20 State machine library which fully tests itself at compile-time upon use (github.com)
1 points by kris-jusiak 1019 days ago
1 comments

Experimental approach towards releasing C++ (small) libraries with tests being executed upon include/import at compile-time. Traditional way of testing libraries includes continuous integration systems with huge matrix of possible combinations of supported compilers/systems etc. Although, that's very powerful there is no way to verify all possible combinations and users often assume that the library just works as it's already tested without verifying on their environment. With C++20 ability to test the library upon use additional guarantees can be put in place (accordingly to the quality of tests). Tests are executed at compile-time during include/import so there is no run-time overhead and compile-time overhead is minimal. With this approach, it can be basically guaranteed that the tested features are working as expected without any leaks and/or UB if the library compiles upon include/import. The feedback is immediate and constantly verified making the solution reliable and without run-time surprises on the client side.