Add TEST names to the harness #9

Merged
fputs merged 1 commit from fputs/test-macro into master 2026-11-05 09:33:10 -08:00 AGit
Owner

Adds TEST(name) to include/lftest.h. A failing assert inside the following block prints the name plus the existing file, line, and expression. A passing block prints nothing. Asserts outside TEST keep the old line. TEST_REPORT still prints passed/total and returns 0 or 1. Counters stay static per translation unit.

ASSERT_EQ still prints through (long long)(intptr_t). tests/test_bitops.c wraps the LF_BIT_SET checks once so the macro is compiled. docs/test.md notes that a multi-file binary must report from the translation unit that ran the asserts.

Tested with -DCMAKE_BUILD_TYPE=Debug -DFLINT_SANITIZE=ON -DCMAKE_C_EXTENSIONS=OFF. ctest --label-exclude slow: 25/25 passed.

Adds `TEST(name)` to `include/lftest.h`. A failing assert inside the following block prints the name plus the existing file, line, and expression. A passing block prints nothing. Asserts outside `TEST` keep the old line. `TEST_REPORT` still prints `passed/total` and returns 0 or 1. Counters stay `static` per translation unit. `ASSERT_EQ` still prints through `(long long)(intptr_t)`. `tests/test_bitops.c` wraps the `LF_BIT_SET` checks once so the macro is compiled. `docs/test.md` notes that a multi-file binary must report from the translation unit that ran the asserts. Tested with `-DCMAKE_BUILD_TYPE=Debug -DFLINT_SANITIZE=ON -DCMAKE_C_EXTENSIONS=OFF`. `ctest --label-exclude slow`: 25/25 passed.
Add TEST names to the harness
All checks were successful
test / test (pull_request) Successful in 12s
test / sanitize (pull_request) Successful in 14s
79ffe7ad8a
fputs merged commit bafd977859 into master 2026-11-05 09:33:10 -08:00
fputs referenced this pull request from a commit 2026-11-05 09:33:12 -08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
fputs/libflint!9
No description provided.