2338ea5d59
ww: lib tests run via -T test mode; bare mains retired (closes @test conversion)
...
'ww test' gains the istest build path (-T injection in build_one/
buildone) and do_test/dotest accept -I, mirroring do_run - both twins.
The 35 converted lib tests drop their interim bare mains (-T
synthesizes the entry from @test fns and rejects a user main); their
35 C run-drivers flip 'ww run' -> 'ww test'; 989_lib_byteid compiles
lib tests under -T (8 user-main probe fixtures stay non-T, gated on
the fixture field). Abort-on-first-failure stands until the deferred
record-and-continue harness lands with the multi-package arc.
2026-06-10 20:45:46 +09:00
a6abac22d8
lib/bytes+test: Hare port (equal / index / rindex / contains / has{prefix,suffix} / reverse / zero)
...
Mirrors ref/hare/bytes/{equal,index,contains,reverse,zero}.ha for
the in-tree subset used by lib/encoding, lib/bufio, lib/memio;
converts 4 hextest sites from local beq to bytes.equal and drops
the now-dead beq in utf8test.
Surface:
- equal(a, b: []u8) bool
- index(s: []u8, needle: (u8 | []u8)) (i32 | void)
- rindex(s: []u8, needle: (u8 | []u8)) (i32 | void)
- contains(s: []u8, needle: (u8 | []u8)) bool
- hasprefix(s, pre: []u8) bool
- hassuffix(s, suf: []u8) bool
- reverse(s: []u8) void (already present, citation added)
- zero(s: []u8) void (already present, citation added)
Two documented Hare-fidelity gaps (cited in lib/bytes/bytes.ww
header, no in-tree caller demands them yet):
- index_slice / rindex_slice use naive O(n·m). Hare specialises
2/3/4-byte needles + falls back to Crochemore-Perrin two-way
(ref/hare/bytes/two_way.ha). Correctness equivalent.
- contains takes a single needle. Hare uses variadic
needle: (u8 | []u8)... (ref/hare/bytes/contains.ha:5).
Tests: 967_bytes_run drives lib/bytes/bytestest.ww via ww run.
Eight @test fns × table-driven row sets: equal (5), index_byte
(5), index_slice (10), rindex_byte (3), rindex_slice (3),
contains (4), hasprefix (6 verbatim from contains.ha:25),
hassuffix (6 verbatim from contains.ha:40).
Call-site conversions in the same commit (the conversions are
the proof the API is wired): lib/encoding/hex/hextest.ww drops
the local beq helper and 4 callers switch to bytes.equal;
lib/encoding/utf8/utf8test.ww drops the dead beq helper.
91/91 ok. 995_self_rebuild stays green (ww2==ww3==ww4 byte-id).
2026-05-18 00:48:14 +09:00