Skip to content

Commit a73cf56

Browse files
dfa1claude
andcommitted
docs: document cross-language testing strategy and JNI-as-oracle principle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6db3281 commit a73cf56

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,28 @@ JMH throughput (ops/s = full-file scans per second). Higher is better.
119119
- Align with vortex-rust and Vortex-go semantics
120120
- Make the JIT happy (constant layouts, predictable strides, no virtual dispatch in hot loops)
121121
- Prepare for the Vector API / Valhalla
122+
- Rigorous testing: unit tests + property-based testing + cross-language integration tests
123+
124+
### Testing strategy
125+
126+
Unit tests verify internal correctness (encoding round-trips, edge cases), but the format has no
127+
formal specification — the Rust implementation is the ground truth. Unit tests alone miss
128+
cross-language wire-format bugs: Java can round-trip a value internally while writing bytes that
129+
another implementation cannot decode.
130+
131+
The `integration` module addresses this by using the Rust JNI reader as a **test oracle**:
132+
Java writes a file, the Rust reader decodes it, and the values are compared exactly.
133+
[Property-based testing](https://jqwik.net/) (jqwik) generates large, diverse inputs automatically,
134+
covering edge cases no hand-written test would anticipate.
135+
136+
This combination caught two real bugs in ALP floating-point encoding:
137+
- Java selected exponents outside the range Rust's decoder accepts (silent data corruption)
138+
- Java's encode round-trip check used a different floating-point associativity than Rust's decode
139+
(`encoded * (F10[f] * IF10[e])` vs `(encoded * F10[f]) * IF10[e]`), passing values that Rust
140+
decoded differently
141+
142+
Both bugs were invisible to pure-Java tests and would have shipped undetected without the
143+
cross-language oracle.
122144

123145
## Implementations
124146

0 commit comments

Comments
 (0)