Given that compiling in Debug
or ReleaseFast
mode may yield different results, I wanted to check if my library code works correctly and catch any bugs by using tests.
However, I couldn't find any option to tell tests to be compiled and run in ReleaseFast
mode. I assume they are all running on Debug
mode by default.
The options are exactly the same as if you were simply compiling the code.
Using the build system:
zig build test -Doptimize=ReleaseFast
Without the build system:
zig test ./test.zig -O ReleaseFast
As a proof of concept, this fails in
Debug
, but works inReleaseFast
:And here is one that fails in
ReleaseFast
but works inDebug
: