Skip to content

Commit 6b10ba8

Browse files
authored
Merge pull request #40 from catbro666/extend-check-require-macro
extend all macros to variadic macros in order to support additional printf-style format string
2 parents 37db776 + a3bb9cf commit 6b10ba8

File tree

2 files changed

+147
-70
lines changed

2 files changed

+147
-70
lines changed

docs/tau-primer.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@ We recommend using `CHECK`s over `ASSERT`s unless it doesn't make sense to conti
104104
### Adding Custom Failure Messages
105105
We highly recommend you add a custom failure message for your macros - it makes it easier to track down bugs. `Invalid Type ID:` is much more useful than `FAILED`, which is what Tau prints by default.
106106
107+
The message can be a printf format string. This is pretty useful when you do the test in a loop. You can quickly know which iteration of the loop failed.
108+
107109
To do this, simply do the following:
108110
```C
109111
CHECK(i == 42, "Expected i to be 42");
112+
113+
CHECK(result == expected[i], "i=%d", i);
110114
```
111115

112116

0 commit comments

Comments
 (0)