Zig has a built-in test system. You do not need a separate testing library to start writing tests.
| Section | Title |
|---|---|
| 1 | Zig Test Framework |
| 2 | Writing Unit Tests |
| 3 | Table-Driven Tests |
| 4 | Fuzz Testing |
| 5 | Debug Builds |
| 6 | Stack Traces |
| 7 | Assertions |
| 8 | Using GDB and LLDB |
| 9 | Memory Debugging |
| 10 | Benchmarking Code |
Zig Test FrameworkZig has a built-in test system. You do not need a separate testing library to start writing tests.
Writing Unit TestsA unit test checks one small piece of code in isolation.
Table-Driven TestsA table-driven test checks many input cases with one test loop.
Fuzz TestingFuzz testing means testing a program with many generated inputs.
Debug BuildsA debug build is a build made for finding mistakes.
Stack TracesA stack trace shows how your program reached a failure.
AssertionsAn assertion is a check that must be true while the program runs.
Using GDB and LLDBGDB and LLDB are debuggers.
Memory DebuggingMemory debugging means finding mistakes in how a program uses memory.
Benchmarking CodeBenchmarking measures how fast code runs.