diff options
| author | Mosder <xmosder12@gmail.com> | 2026-08-10 20:11:13 +0200 |
|---|---|---|
| committer | Mosder <xmosder12@gmail.com> | 2026-08-10 20:11:13 +0200 |
| commit | 22679c1e0a781f32b493e15992259bffeb884aa1 (patch) | |
| tree | 997d5c8b1bfb11de7f234b15a0ccb52fec831923 /tests/mem | |
| parent | 28f2d2789054f6dc1929086c5022d0e8dca6a3d5 (diff) | |
feat: added ability to suppress and unsuppress outputs in tester (removed 2>/dev/null from run_tests thanks to that)
Diffstat (limited to 'tests/mem')
| -rw-r--r-- | tests/mem/alloc_tests.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/mem/alloc_tests.c b/tests/mem/alloc_tests.c index 6eb2e9c..17973c7 100644 --- a/tests/mem/alloc_tests.c +++ b/tests/mem/alloc_tests.c @@ -10,8 +10,11 @@ Test malloc_exit() { Test test_safe_malloc() { void *p = safe_malloc(1024); - test_assert(p != NULL, "Should be able to malloc 1KiB"); + test_assert(p != NULL, "Failed to malloc 1KiB"); + + suppress_output(&stderr); test_assert_exit(malloc_exit, EXIT_FAILURE); + unsuppress_outputs(); } Test realloc_exit() { @@ -22,12 +25,14 @@ Test realloc_exit() { Test test_safe_realloc() { void *p = NULL; p = safe_realloc(p, 1024); - test_assert(p != NULL, "Should be able to realloc NULL to 1KiB"); + test_assert(p != NULL, "Failed to realloc NULL to 1KiB"); p = safe_realloc(p, 4096); - test_assert(p != NULL, "Should be able to realloc 1KiB to 4KiB"); + test_assert(p != NULL, "Failed to realloc 1KiB to 4KiB"); + suppress_output(&stderr); test_assert_exit(realloc_exit, EXIT_FAILURE); + unsuppress_outputs(); } void mem_alloc_tests(Tester *tester) { |
