test: roster appends struct call rvalues; cursor idiom retired (#34)
This commit is contained in:
@@ -55,43 +55,32 @@ type ent = struct {
|
||||
moddir: str, // probe-only: completeness key
|
||||
};
|
||||
|
||||
// #34: append() rejects struct-call-result sources, so the roster is a
|
||||
// preallocated slice filled by per-row field writes behind a running
|
||||
// cursor; the cursor total re-proves the NENTEXPECT count.
|
||||
fn zeroent(e: *ent) void = {
|
||||
e.fixture = ""; e.probe = ""; e.inc = ""; e.mode = MID;
|
||||
// Row constructors; the roster appends their results directly (#34
|
||||
// closed — append accepts struct call rvalues).
|
||||
fn fx(f: str) ent = {
|
||||
let e: ent;
|
||||
e.fixture = f; e.probe = ""; e.inc = ""; e.mode = MID;
|
||||
e.cite = ""; e.sentinel = ""; e.moddir = "";
|
||||
return e;
|
||||
};
|
||||
|
||||
fn fx(es: []ent, k: *i32, f: str) void = {
|
||||
let i: i32 = *k;
|
||||
es[i].fixture = f;
|
||||
*k = i + 1;
|
||||
fn fxi(f: str, inc: str) ent = {
|
||||
let e: ent = fx(f);
|
||||
e.inc = inc;
|
||||
return e;
|
||||
};
|
||||
|
||||
fn fxi(es: []ent, k: *i32, f: str, inc: str) void = {
|
||||
let i: i32 = *k;
|
||||
es[i].fixture = f;
|
||||
es[i].inc = inc;
|
||||
*k = i + 1;
|
||||
fn pr(p: str, sentinel: str, moddir: str) ent = {
|
||||
let e: ent = fx("");
|
||||
e.probe = p;
|
||||
e.sentinel = sentinel; e.moddir = moddir;
|
||||
return e;
|
||||
};
|
||||
|
||||
fn pr(es: []ent, k: *i32, p: str, sentinel: str, moddir: str) void = {
|
||||
let i: i32 = *k;
|
||||
es[i].probe = p;
|
||||
es[i].sentinel = sentinel;
|
||||
es[i].moddir = moddir;
|
||||
*k = i + 1;
|
||||
};
|
||||
|
||||
fn pri(es: []ent, k: *i32, p: str, inc: str, sentinel: str,
|
||||
moddir: str) void = {
|
||||
let i: i32 = *k;
|
||||
es[i].probe = p;
|
||||
es[i].inc = inc;
|
||||
es[i].sentinel = sentinel;
|
||||
es[i].moddir = moddir;
|
||||
*k = i + 1;
|
||||
fn pri(p: str, inc: str, sentinel: str, moddir: str) ent = {
|
||||
let e: ent = pr(p, sentinel, moddir);
|
||||
e.inc = inc;
|
||||
return e;
|
||||
};
|
||||
|
||||
// The 44-unit roster. Graduation history lives in git (the retired C
|
||||
@@ -99,73 +88,68 @@ fn pri(es: []ent, k: *i32, p: str, inc: str, sentinel: str,
|
||||
// would need them.
|
||||
fn corpus() []ent = {
|
||||
let es: []ent = alloc([], NENTEXPECT: u64)!;
|
||||
es.len = NENTEXPECT;
|
||||
let z: i32 = 0;
|
||||
for (z < es.len) { zeroent(&es[z]); z += 1; };
|
||||
let n: i32 = 0;
|
||||
let k: *i32 = &n;
|
||||
fx(es, k, "lib/bytes/bytes_test.ww");
|
||||
fx(es, k, "lib/dirs/dirs_test.ww");
|
||||
fx(es, k, "lib/encoding/base32/base32_test.ww");
|
||||
fx(es, k, "lib/encoding/hex/hex_test.ww");
|
||||
fx(es, k, "lib/encoding/utf8/utf8_test.ww");
|
||||
fx(es, k, "lib/getopt/getopt_test.ww");
|
||||
fx(es, k, "lib/hash/adler32/adler32_test.ww");
|
||||
fx(es, k, "lib/hash/crc16/crc16_test.ww");
|
||||
fx(es, k, "lib/hash/crc32/crc32_test.ww");
|
||||
fx(es, k, "lib/hash/crc64/crc64_test.ww");
|
||||
fx(es, k, "lib/hash/siphash/siphash_test.ww");
|
||||
fx(es, k, "lib/math/checked/checked_test.ww");
|
||||
fx(es, k, "lib/math/random/random_test.ww");
|
||||
fx(es, k, "lib/memio/memio_test.ww");
|
||||
fx(es, k, "lib/os/os_test.ww");
|
||||
pr(es, k, "package main;\nimport os.exec;\nfn main() i32 = { return 0; };\n",
|
||||
"package exec;", "lib/os/exec");
|
||||
fx(es, k, "lib/regex/regex_test.ww");
|
||||
fx(es, k, "lib/strconv/test/ftos_test.ww");
|
||||
fx(es, k, "lib/strconv/test/stof_test.ww");
|
||||
fx(es, k, "lib/strconv/test/int_test.ww");
|
||||
fx(es, k, "lib/strings/strings_test.ww");
|
||||
fx(es, k, "lib/temp/temp_test.ww");
|
||||
fx(es, k, "lib/time/time_test.ww");
|
||||
fx(es, k, "lib/bufio/bufio_test.ww");
|
||||
fx(es, k, "lib/fmt/fmt_test.ww");
|
||||
pr(es, k, "package main;\nimport sort;\nfn main() i32 = { return 0; };\n",
|
||||
"package sort;", "lib/sort");
|
||||
pr(es, k, "package main;\nimport path;\nfn main() i32 = { return 0; };\n",
|
||||
"package path;", "lib/path");
|
||||
pr(es, k, "package main;\nimport endian;\nfn main() i32 = { return 0; };\n",
|
||||
"package endian;", "lib/endian");
|
||||
pr(es, k, "package main;\nimport net;\nfn main() i32 = { return 0; };\n",
|
||||
"package net;", "lib/net");
|
||||
pr(es, k, "package main;\nimport hash;\nfn main() i32 = { return 0; };\n",
|
||||
"package hash;", "lib/hash");
|
||||
append(es, fx("lib/bytes/bytes_test.ww"));
|
||||
append(es, fx("lib/dirs/dirs_test.ww"));
|
||||
append(es, fx("lib/encoding/base32/base32_test.ww"));
|
||||
append(es, fx("lib/encoding/hex/hex_test.ww"));
|
||||
append(es, fx("lib/encoding/utf8/utf8_test.ww"));
|
||||
append(es, fx("lib/getopt/getopt_test.ww"));
|
||||
append(es, fx("lib/hash/adler32/adler32_test.ww"));
|
||||
append(es, fx("lib/hash/crc16/crc16_test.ww"));
|
||||
append(es, fx("lib/hash/crc32/crc32_test.ww"));
|
||||
append(es, fx("lib/hash/crc64/crc64_test.ww"));
|
||||
append(es, fx("lib/hash/siphash/siphash_test.ww"));
|
||||
append(es, fx("lib/math/checked/checked_test.ww"));
|
||||
append(es, fx("lib/math/random/random_test.ww"));
|
||||
append(es, fx("lib/memio/memio_test.ww"));
|
||||
append(es, fx("lib/os/os_test.ww"));
|
||||
append(es, pr("package main;\nimport os.exec;\nfn main() i32 = { return 0; };\n",
|
||||
"package exec;", "lib/os/exec"));
|
||||
append(es, fx("lib/regex/regex_test.ww"));
|
||||
append(es, fx("lib/strconv/test/ftos_test.ww"));
|
||||
append(es, fx("lib/strconv/test/stof_test.ww"));
|
||||
append(es, fx("lib/strconv/test/int_test.ww"));
|
||||
append(es, fx("lib/strings/strings_test.ww"));
|
||||
append(es, fx("lib/temp/temp_test.ww"));
|
||||
append(es, fx("lib/time/time_test.ww"));
|
||||
append(es, fx("lib/bufio/bufio_test.ww"));
|
||||
append(es, fx("lib/fmt/fmt_test.ww"));
|
||||
append(es, pr("package main;\nimport sort;\nfn main() i32 = { return 0; };\n",
|
||||
"package sort;", "lib/sort"));
|
||||
append(es, pr("package main;\nimport path;\nfn main() i32 = { return 0; };\n",
|
||||
"package path;", "lib/path"));
|
||||
append(es, pr("package main;\nimport endian;\nfn main() i32 = { return 0; };\n",
|
||||
"package endian;", "lib/endian"));
|
||||
append(es, pr("package main;\nimport net;\nfn main() i32 = { return 0; };\n",
|
||||
"package net;", "lib/net"));
|
||||
append(es, pr("package main;\nimport hash;\nfn main() i32 = { return 0; };\n",
|
||||
"package hash;", "lib/hash"));
|
||||
// fnv lives off the driver's default root (lib/hash/fnv)
|
||||
pri(es, k, "package main;\nimport fnv;\nfn main() i32 = { return 0; };\n",
|
||||
"lib/hash/fnv", "package fnv;", "lib/hash/fnv");
|
||||
append(es, pri("package main;\nimport fnv;\nfn main() i32 = { return 0; };\n",
|
||||
"lib/hash/fnv", "package fnv;", "lib/hash/fnv"));
|
||||
// sentinel is a fn, not `package math;` — lib/math is also package
|
||||
// math, so a silent fallback there would still match
|
||||
pr(es, k, "package main;\nimport crypto.math;\nfn main() i32 = { return 0; };\n",
|
||||
"fn rotl32", "lib/crypto/math");
|
||||
pr(es, k, "package main;\nimport c.libc;\nfn main() i32 = { return 0; };\n",
|
||||
"package libc;", "lib/c/libc");
|
||||
append(es, pr("package main;\nimport crypto.math;\nfn main() i32 = { return 0; };\n",
|
||||
"fn rotl32", "lib/crypto/math"));
|
||||
append(es, pr("package main;\nimport c.libc;\nfn main() i32 = { return 0; };\n",
|
||||
"package libc;", "lib/c/libc"));
|
||||
// root-only, ZERO-dep build -S: the one driver-leg edge every
|
||||
// import probe misses (dep-count-0 unit composition). Folded in
|
||||
// from the retired 815/940/951 driver-parity carriers. No
|
||||
// sentinel: there is no dep unit to prove.
|
||||
pr(es, k, "package main;\nfn main() i32 = { return 0; };\n", "", "");
|
||||
fx(es, k, "lib/ascii/ascii_test.ww");
|
||||
fx(es, k, "lib/encoding/base64/base64_test.ww");
|
||||
fx(es, k, "lib/errors/errno_test.ww");
|
||||
fx(es, k, "lib/log/log_test.ww");
|
||||
fx(es, k, "lib/os/stat_test.ww");
|
||||
append(es, pr("package main;\nfn main() i32 = { return 0; };\n", "", ""));
|
||||
append(es, fx("lib/ascii/ascii_test.ww"));
|
||||
append(es, fx("lib/encoding/base64/base64_test.ww"));
|
||||
append(es, fx("lib/errors/errno_test.ww"));
|
||||
append(es, fx("lib/log/log_test.ww"));
|
||||
append(es, fx("lib/os/stat_test.ww"));
|
||||
// toktest/asttest resolve `import syntax` via -I lib/ww, cf 905
|
||||
fxi(es, k, "lib/ww/syntax/tok_test.ww", "lib/ww");
|
||||
fxi(es, k, "lib/ww/syntax/ast_test.ww", "lib/ww");
|
||||
fx(es, k, "lib/crypto/sha256/sha256_test.ww");
|
||||
fx(es, k, "lib/fnmatch/fnmatch_test.ww");
|
||||
fx(es, k, "lib/shlex/shlex_test.ww");
|
||||
assert(n == NENTEXPECT);
|
||||
append(es, fxi("lib/ww/syntax/tok_test.ww", "lib/ww"));
|
||||
append(es, fxi("lib/ww/syntax/ast_test.ww", "lib/ww"));
|
||||
append(es, fx("lib/crypto/sha256/sha256_test.ww"));
|
||||
append(es, fx("lib/fnmatch/fnmatch_test.ww"));
|
||||
append(es, fx("lib/shlex/shlex_test.ww"));
|
||||
assert(es.len == NENTEXPECT);
|
||||
return es;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user