I wanted to find out how nice of a unit testing “DSL” I could make by abusing the C preprocessor, and I think the result isn’t too bad.
One notable feature are the Go-inspired defer functionality, which I think makes tearing down tests really nice, and makes teardown basically “just work” even when a test case fails. I also used the C11 _Generic stuff to make
asserteq(a, b) and
assertneq(a, b) automatically choose whether to compare strings or scalar values.
So, what does people think? Constructive criticism is welcome.