POST coverage cluster 2/4: Q48.16 math primitives (proof-covered, previously untested)
New module (q48_words_test.c, Module 25 -- matches word_registry.c's own existing numbering for this file's registration) covers all 23 words in q48_words.c: no test file existed for this file at all before. Standard WordTestSuite/TestCase tabular format, unlike ACL's hand-rolled style -- these are pure stateless functions, a natural fit. 28 TestCase entries; values built via Q.FROM-INT/Q.1/Q.0, read back via Q.TO-INT for readable log output. Verified q48_16.h's q48_to_u64() sign-extends through a signed int64_t intermediate before writing the Q.NEG/Q.ABS tests, rather than assuming negative round-trip works. Boot-verified: zero build warnings, all 23 words pass individually, FINAL TEST SUMMARY 1003->1031 total / 965->993 passed (+28 exactly), 0 failed, 0 errors. Noted (pre-existing, not fixed): print_module_summary() is called with hardcoded (name,0,0,0,0) across every WordTestSuite module in the tree, including this new one -- decorative, always zero; the real counts live in each word's own per-suite line and the global summary. Cluster 3 of 4 in the POST-coverage sequence (code sweeps -> HOL green -> POST coverage, one proof-covered cluster at a time). Two clusters left: inference-engine accessors, physics freeze/diagnostic. Full writeup in FABRIC-2.md Section J. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b2918fd0b2
commit
7100523656
+33
@@ -1473,3 +1473,36 @@ evidence the bug was real and caught, not hidden), `logs/20260818-231403/` the f
|
||||
Remaining clusters (Q48.16, inference-engine, physics freeze/diagnostic) not yet started —
|
||||
next up, one at a time, same process: read the C implementation, write tests matching that
|
||||
file's existing style, boot and verify before committing.
|
||||
|
||||
**Cluster 2, Q48.16 math primitives — done.** No test file for `q48_words.c` existed at all
|
||||
(confirmed by absence, not by reading one and finding it thin) — all 23 registered words
|
||||
(`Q.+`, `Q.-`, `Q.*`, `Q./`, `Q.ABS`, `Q.NEG`, `Q.LOG`, `Q.EXP`, `Q.SQRT`, `Q.SIN`, `Q.COS`,
|
||||
`Q.FROM-INT`, `Q.TO-INT`, `Q.1`, `Q.0`, `Q.SCALE`, `Q.=`, `Q.<`, `Q.>`, `Q.0=`, `Q.MAX`,
|
||||
`Q.MIN`, `Q.PRINT`) had zero POST coverage, not just the 17 `proof/COVERAGE.md` marks
|
||||
proof-covered — covering the whole file was simpler and more valuable than partitioning by
|
||||
proof status. Unlike ACL's hand-rolled style, these are pure stateless functions — a natural
|
||||
fit for the standard `WordTestSuite`/`TestCase` tabular format the majority of the tree
|
||||
already uses, so a new file (`q48_words_test.c`, Module 25 — matching `word_registry.c`'s own
|
||||
existing "Module 25: Q48.16 Fixed-Point Math" numbering, not a coincidence, both count the
|
||||
same registration) was added rather than extending an existing one. 28 `TestCase` entries
|
||||
total (some words got two — a true/false pair for comparisons, a divide-by-zero edge case for
|
||||
`Q./`). New words compose values via `Q.FROM-INT`/`Q.1`/`Q.0` and read them back via
|
||||
`Q.TO-INT` so the log shows plain readable integers.
|
||||
|
||||
One genuine implementation subtlety checked before writing tests, not assumed: whether
|
||||
`Q.TO-INT` round-trips a *negative* Q48.16 value correctly (needed for the `Q.NEG`/`Q.ABS`
|
||||
tests). `q48_16.h`'s own `q48_to_u64()` comment confirms it shifts through a signed `int64_t`
|
||||
intermediate specifically to sign-extend correctly — verified in the header before trusting
|
||||
it, not discovered by a failing test.
|
||||
|
||||
Verified: zero build warnings, boot-tested, all 23 words individually pass (each printing its
|
||||
own `N passed, 0 failed, 0 stubs, 0 errors` line). `FINAL TEST SUMMARY` total moved from
|
||||
1003→1031, passed 965→993 (exactly +28, matching the new entry count precisely), failed and
|
||||
errors unchanged at 0. Noted in passing, not fixed (pre-existing, not introduced by this
|
||||
change): `print_module_summary()` is called with hardcoded `(name, 0, 0, 0, 0)` across
|
||||
*every* `WordTestSuite`-based module in the tree, including this new one — the per-module
|
||||
"X Summary: 0 passed, 0 failed..." line is decorative and always zero; the real counts are
|
||||
only in each word's own line and the global `FINAL TEST SUMMARY`. Confirmed pre-existing by
|
||||
checking `Arithmetic Words Summary` in the same boot log, not introduced here.
|
||||
|
||||
Two clusters left: inference-engine accessors (8 words), physics freeze/diagnostic (5 words).
|
||||
|
||||
Reference in New Issue
Block a user