File tree Expand file tree Collapse file tree 3 files changed +417
-1
lines changed
Expand file tree Collapse file tree 3 files changed +417
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ Currently ready-to-use modules include:
3535 * [ clock] ( https://github.com/nemequ/portable-snippets/tree/master/clock ) —
3636 cross-platform wall clock, CPU time, and monotonic time
3737
38- There are also modules which are not yet ready for widespread use, but
38+ There are also modules which may not yet be ready for widespread use, but
3939would benefit greatly from testing:
4040
4141 * [ unaligned] ( https://github.com/nemequ/portable-snippets/tree/master/unaligned ) —
@@ -46,6 +46,8 @@ would benefit greatly from testing:
4646 random number generation (3 flavors: cryptographic, reproducible, and fast)
4747 * [ debug-trap] ( https://github.com/nemequ/portable-snippets/tree/master/debug-trap ) —
4848 debugging traps and assertions
49+ * [ check] ( https://github.com/nemequ/portable-snippets/tree/master/check ) —
50+ assertion checking
4951
5052Modules can be used in isolation, though some do work better together,
5153so if you can keep the whole repository together instead of just
Original file line number Diff line number Diff line change 1+ # Assertion Checking
2+
3+ This module provide a variety of assert()-style macros. Unlike the
4+ standard ` assert() ` macro from ` <assert.h> ` , most of these macros are
5+ typed so the input values can be propogated to the string output on
6+ failure.
7+
8+ For documentation, µnit offers very similar macros (this module was
9+ originally based off of the macros from µnit), most of
10+ [ the documentation for them] ( https://nemequ.github.io/munit/#assertions )
11+ applies to this module's macros, just substitute the ` munit_ ` namespace
12+ with ` psnip_ ` .
13+
14+ Additionally, unless you define ` PSNIP_CHECK_FAIL_DEFINED ` , a failing
15+ assertion will considered undefined behavior even when ` NDEBUG ` is
16+ defined. This allows the compiler to perform optimizations which
17+ would not otherwise be possible.
18+
19+ ## Dependencies
20+
21+ To maximize portability you should #include the exact-int module
22+ before including check.h, but if you don't want to add the extra
23+ file to your project you can omit it and this module will simply rely
24+ on <stdint.h>. As an alternative you may define the following macros
25+ to appropriate values yourself:
26+
27+ * ` psnip_int8_t `
28+ * ` psnip_uint8_t `
29+ * ` psnip_int16_t `
30+ * ` psnip_uint16_t `
31+ * ` psnip_int32_t `
32+ * ` psnip_uint32_t `
33+ * ` psnip_int64_t `
34+ * ` psnip_uint64_t `
35+
36+ Including [ Hedley] ( https://nemequ.github.io/hedley/ ) before check.h
37+ will significantly improve compiler support and may improve
38+ performance.
You can’t perform that action at this time.
0 commit comments