lib: banner purge + WHY-only comment sweep (rule 8)

Every // ---- section banner dies (132 -> 0): names carry the WHAT.
Narration deleted (filename restatements, run-with lines, what-the-
next-line-does); every ref/hare cite, task cite, divergence, ABI/
layout contract, and ownership qualifier kept (borrowed-view lines
restored where the sweep over-cut). Comment-only proven: all 442
walk-workdir .s and 32 import-probe .s byte-identical before/after;
libbyteid 56-roster all-ID.
This commit is contained in:
2026-08-08 21:10:18 +09:00
parent 659e859f34
commit aadc6618f0
90 changed files with 259 additions and 919 deletions

View File

@@ -1,5 +1,3 @@
// encoding/base32 — RFC 4648 base32 encode/decode, buffer-based.
//
// Mirrors Hare's encoding::base32 surface, modulo Hare's stream-based
// encoder/decoder. ww ships the in-memory subset only: `encode(dst,
// src)` writes the encoded bytes into `dst`, returning the count;

View File

@@ -86,7 +86,6 @@ fn enchexvec(input: str, expect: str) void = {
};
@test fn roundtrip_all_quintets() void = {
// Encode then decode every 5-byte combination of a small set.
let raw: [5]u8;
raw[0] = 0x00u8;
raw[1] = 0x55u8;

View File

@@ -1,9 +1,7 @@
// base64_test — exercises lib/encoding/base64's io-streaming surface.
// Run with `out/bin/ww run lib/encoding/base64/base64_test.ww`. Mirrors
// Hare's base64 @test fns (ref/hare/encoding/base64/base64.ha:315,514,
// 601) over the RFC 4648 §10 vectors, table-driven (parallel arrays;
// tuple-row arrays are blocked by #111). A failing row aborts via the
// assert/abort builtin (task #5 @test conversion).
// Mirrors Hare's base64 @test fns (ref/hare/encoding/base64/base64.ha:
// 315,514,601) over the RFC 4648 §10 vectors, table-driven (parallel
// arrays; tuple-row arrays are blocked by #111). A failing row aborts
// via the assert/abort builtin (task #5 @test conversion).
//
// The streaming decoder (newdecoder) is deferred (#247-sibling), so the
// decode side is exercised through decodestr only.
@@ -60,8 +58,6 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
};
};
// ---- RFC 4648 §10 vectors, encode + decodestr round-trip ----
//
// Inputs are the prefixes of "foobar". The §10 expected encodings
// contain no '+' / '/', so std and base64url agree on these vectors —
// both alphabets are driven over the same table here; the std-vs-url
@@ -91,8 +87,6 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
};
};
// ---- std vs base64url alphabet distinctness ----
//
// [0xFB, 0xFF, 0xBF] hits the 62/63 alphabet slots: std emits '+'/'/',
// url emits '-'/'_'. The two encodings must differ, each round-trips
// under its own alphabet, and each is INVALID under the other (std
@@ -112,8 +106,6 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
inval_check(&base64.url_encoding, s_std);
};
// ---- decodestr error cases ---- ref/hare/encoding/base64/base64.ha:525
//
// Table-driven (parallel-array idiom; tuple rows blocked by #111). Each
// row exercises one malformed class the hand-written validation in
// decodestr must reject. Cross-alphabet chars are covered separately by
@@ -142,8 +134,6 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
};
};
// ---- size calc ---- ref/hare/encoding/base64/base64.ha:601
@test fn sizes() void = {
assert(!(base64.encodedsize(0) != 0));
assert(!(base64.encodedsize(1) != 4));
@@ -172,8 +162,6 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
base64.decodedsize(5i32);
};
// ---- round-trip every byte value 0..255 (std + url) ----
@test fn roundtrip_all_bytes() void = {
let src: [256]u8;
let i: i32 = 0;

View File

@@ -1,8 +1,6 @@
// hextest — exercises lib/encoding/hex's io-streaming surface. Run with
// `out/bin/ww run lib/encoding/hex/hextest.ww`. Mirrors Hare's hex
// @test fns (ref/hare/encoding/hex/hex.ha:82,96,194) plus a full-byte
// round-trip. A failing row aborts via the assert/abort builtin (task #5
// @test conversion).
// Mirrors Hare's hex @test fns (ref/hare/encoding/hex/hex.ha:82,96,194)
// plus a full-byte round-trip. A failing row aborts via the assert/abort
// builtin (task #5 @test conversion).
//
// The streaming decoder (newdecoder) is deferred (#247), so the decode
// side is exercised through decodestr only.
@@ -33,8 +31,6 @@ fn cafebabe() [8]u8 = {
return r;
};
// ---- encodestr ---- ref/hare/encoding/hex/hex.ha:82
@test fn encodestr_basic() void = {
let in: [8]u8 = cafebabe();
assert(!(!streq(hex.encodestr(in[0:8]), "cafebabedeadf00d")));
@@ -57,8 +53,6 @@ fn cafebabe() [8]u8 = {
assert(!(hex.encodestr(in[0:0]).len != 0));
};
// ---- encode (io.handle sink) ---- ref/hare/encoding/hex/hex.ha:96
@test fn encode_stream() void = {
let in: [8]u8 = cafebabe();
let out: memio.stream = memio.dynamic();
@@ -69,8 +63,6 @@ fn cafebabe() [8]u8 = {
assert(!(!streq(memio.string(&out), "cafebabedeadf00d")));
};
// ---- decodestr round-trip ---- ref/hare/encoding/hex/hex.ha:194
@test fn decodestr_lower() void = {
match (hex.decodestr("cafebabedeadf00d")) {
case let b: []u8 => {
@@ -110,9 +102,8 @@ fn cafebabe() [8]u8 = {
};
};
// ---- decodestr error cases ---- ref/hare/encoding/hex/hex.ha:154,199
//
// Odd length and non-hex chars both return errors.invalid.
// Odd length and non-hex chars both return errors.invalid
// (ref/hare/encoding/hex/hex.ha:154,199).
@test fn decodestr_odd() void = {
match (hex.decodestr("abc")) {
@@ -135,8 +126,6 @@ fn cafebabe() [8]u8 = {
};
};
// ---- round-trip every byte value 0..255 --------------------------------
@test fn roundtrip_all_bytes() void = {
let src: [256]u8;
let i: i32 = 0;

View File

@@ -1,7 +1,5 @@
// decodetest — exercises the utf8 decoder: next/prev/validate/
// remaining/slice/position, plus the encode→decode round-trip. A
// failing row aborts via the assert/abort builtin (task #5 @test
// conversion). Vectors mirror ref/hare/encoding/utf8/decode.ha.
// Vectors mirror ref/hare/encoding/utf8/decode.ha. A failing row aborts
// via the assert/abort builtin (task #5 @test conversion).
package utf8_test;

View File

@@ -1,6 +1,5 @@
// encodetest — exercises utf8.encoderune. A failing row aborts via
// the assert/abort builtin (task #5 @test conversion).
// Vectors mirror ref/hare/encoding/utf8/encode.ha.
// Vectors mirror ref/hare/encoding/utf8/encode.ha. A failing row aborts
// via the assert/abort builtin (task #5 @test conversion).
package utf8_test;

View File

@@ -1,6 +1,5 @@
// runetest — exercises utf8.runesz/utf8sz. A failing row aborts via
// the assert/abort builtin (task #5 @test conversion).
// Vectors mirror ref/hare/encoding/utf8/rune.ha.
// Vectors mirror ref/hare/encoding/utf8/rune.ha. A failing row aborts
// via the assert/abort builtin (task #5 @test conversion).
package utf8_test;

View File

@@ -1,6 +1,5 @@
// typestest — exercises utf8.strerror. A failing row aborts via the
// Mirrors ref/hare/encoding/utf8/types.ha. A failing row aborts via the
// assert/abort builtin (task #5 @test conversion).
// Mirrors ref/hare/encoding/utf8/types.ha.
package utf8_test;

View File

@@ -1,4 +1,4 @@
// encoding/utf8 — UTF-8 encode/decode. Hare port; see
// Hare port; see
// ref/hare/encoding/utf8/{types,rune,encode,decode,decodetable}.ha.
//
// The decoder is Hoehrmann's branchless DFA, originally published
@@ -453,4 +453,3 @@ export fn slice(begin: *decoder, end: *decoder) []u8 = {
export fn position(d: *decoder) i32 = {
return d.offs: i32;
};