Warning don’t use this from two threads at once. I would have passed around a “test context” that can store the results such as int tt_passes, int tt_fails, etc. Prefixing the macros TT_RUN to avoid potential clashes would have been good too.
I like single-header unit test frameworks for C. If you’re interested in something with a few more features, I absolutely love Greatest: https://github.com/silentbicycle/greatest.
Simple testing frameworks are great, but instead of mixing presentation and testing, you could perhaps emit TAP https://lobste.rs/s/n6y1qt/test_anything_protocol and use existing test harnesses?
Warning don’t use this from two threads at once. I would have passed around a “test context” that can store the results such as int tt_passes, int tt_fails, etc. Prefixing the macros TT_RUN to avoid potential clashes would have been good too.
I like single-header unit test frameworks for C. If you’re interested in something with a few more features, I absolutely love Greatest: https://github.com/silentbicycle/greatest.
We used to use something like:
EDIT:
We really need to support code blocks in the markup…