Commit graph

18 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
d014682206 Add t_is_zero predicates. 2022-09-16 11:09:55 +02:00
Dag-Erling Smørgrav
562ffa391e Slight cleanup. 2017-05-11 00:08:45 +02:00
Dag-Erling Smørgrav
8e0f4a293e Determine the default for CRYB_LEAKTEST at run-time.
When cryb-test is used as a framework for another project, the compile-time test is useless since cryb-test itself will have been built with coverage disabled.  Besides, it is not a reliable indicator of whether leak detection will work.  Instead, check if the heap is already dirty when we first gain control.
2017-05-11 00:08:45 +02:00
Dag-Erling Smørgrav
3917a6dfd7 Annotate t_add_test() as printf()-like and fix the fallout. 2017-03-14 15:07:02 +01:00
Dag-Erling Smørgrav
52cf1f9d3c Rename t_verbose*() to t_printv*().
Not only is this a slightly more logical name, but it allows us to expose the verbose flag, previously private to cryb_t_main.c, as the equally logically named t_verbose.
2017-03-14 14:36:52 +01:00
Dag-Erling Smørgrav
f70dac496f Mechanically bump copyright dates to the date of the latest commit. 2017-02-19 20:07:43 +01:00
Dag-Erling Smørgrav
071e9e7e32 Fix accidental reintroduction of <cryb/attributes.h>, previously renamed to <cryb/defs.h>. 2016-11-14 13:11:44 +01:00
Dag-Erling Smørgrav
856571a06d Implement a soft assert for unit tests.
Unlike assert(3), which uses abort(3), this has no other side effects (before raising SIGABRT) than an fprintf() call.  The test framework will catch the SIGABRT, report that the test case failed, and proceed with the next case.
2016-11-14 13:00:16 +01:00
Dag-Erling Smørgrav
c4798b486c Constify t_compare_ptr(). 2016-10-03 16:55:27 +02:00
Dag-Erling Smørgrav
b77cb1aeb4 Tidy up the headers a bit and make them C++-safe. 2016-10-03 12:31:16 +02:00
Dag-Erling Smørgrav
06a757e878 Big reorganization and cleanup 2016-09-04 14:56:39 +02:00
Dag-Erling Smørgrav
401465d8ea Move main() from libcryb-test to the test program.
Instead of having libcryb-test provide main() and assume that the test program defines t_prepare() and t_cleanup(), have libcryb-test provide a t_main() function which the test program calls with pointers to its prepare and cleanup functions.
2016-03-15 14:29:44 +01:00
Dag-Erling Smørgrav
c68fd1098d We need <cryb/attributes.h> here for the CRYB_PRINTF() macro. 2016-03-15 14:28:47 +01:00
Dag-Erling Smørgrav
6eaaac308f Add a t_compare_strn() function which is to t_compare_str() what strncmp() is to
strcmp().
2016-01-10 18:49:19 +01:00
Dag-Erling Smørgrav
955cbc3013 Add t_malloc_snapshot() which writes a snapshot of the allocator state to
a caller-provided buffer.  Use it to warn about leaks in each individual
test case.  Note that we can't fail a test case for leaking, because
individual test cases in a unit may modify shared state which is cleaned
up at the end of the series.
2015-11-02 19:34:03 +00:00
Dag-Erling Smørgrav
0a9f2c21fe When running a test, make sure it didn't leave allocation failure enabled.
Add predicates for null and non-null pointers.
Staticize some internal allocator state.
2015-10-13 21:39:47 +00:00
Dag-Erling Smørgrav
f67b3cf5da Add missing prototype for t_compare_ssz() 2015-10-12 10:19:53 +00:00
Dag-Erling Smørgrav
f8ebdbc14d Move the test framework into its own subdirectory 2015-10-04 07:49:48 +00:00
Renamed from t/t.h (Browse further)