Final fold-2 chunk. The 12 Fam13 single-file value drivers move from test/wcc/*_run.c into in-language @test row-tables under test/lang/: - value rows -> test/lang/*_test.ww (12 files) - reject rows -> runww //ww:error carriers (13, dual-stage non-vacuous) - nullable abort rows -> runww //ww:run-exit 1 carriers (3) - 953_globalslice_arg -> _runonly (cs!=ww checker divergence, #28) - 788 value_not_type_neg + 953_arrlit_slice reject_assign kept as slim rc-only .c pins (divergent-diag dual-reject, mutation-gated); 788 #29 Coverage parity verified row-by-row vs each retired driver; advisor- ratified carve taxonomy; two-round reviewed. Floor ratchet follows.
61 lines
1.6 KiB
Plaintext
61 lines
1.6 KiB
Plaintext
// arrlit_slice_test — #25/#31: a one-step array-LITERAL initialiser for a SLICE
|
|
// local (`let xs: []T = [..]`). Migrated from test/wcc/953_arrlit_slice_run.c
|
|
// (value rows; cs==ww byte-id rides T2). Reject rows (out-of-range element +
|
|
// the three non-let-borrow contexts) stay as runww //ww:error carriers under
|
|
// test/wcc/data/.
|
|
//
|
|
// #31 (silent cs!=ww): the borrow wrapped the un-addressable arrlit directly,
|
|
// so .ptr pointed at garbage (xs[1] returned 1, not 20; []u8/[]str SEGV). #25
|
|
// (over-strict): bare-int-width / str elements rejected. The fix re-stamps the
|
|
// arrlit [count]T and materialises a fresh per-borrow stack slot. multi_live is
|
|
// the SOUNDNESS pin: a shared backing slot would alias the two borrows (4+4=8).
|
|
|
|
package arrlit_slice_test;
|
|
|
|
@test fn i32_sum() void = {
|
|
let xs: []i32 = [10, 20, 30];
|
|
assert(xs[0] + xs[1] + xs[2] == 60);
|
|
};
|
|
|
|
@test fn i32_idx() void = {
|
|
let xs: []i32 = [10, 20, 30];
|
|
assert(xs[1] == 20);
|
|
};
|
|
|
|
@test fn u8_coerce() void = {
|
|
let zs: []u8 = [1, 2, 3];
|
|
assert(zs[0]: i32 + zs[1]: i32 + zs[2]: i32 == 6);
|
|
};
|
|
|
|
@test fn u8_typed() void = {
|
|
let xs: []u8 = [10u8, 20u8, 30u8];
|
|
assert(xs[2]: i32 == 30);
|
|
};
|
|
|
|
@test fn i64_stride() void = {
|
|
let xs: []i64 = [7i64, 42i64];
|
|
assert(xs[1] == 42);
|
|
};
|
|
|
|
@test fn str_read() void = {
|
|
let ys: []str = ["ab", "c"];
|
|
assert(ys[0].len: i32 * 10 + ys[1].len: i32 == 21);
|
|
};
|
|
|
|
@test fn len_read() void = {
|
|
let xs: []i32 = [10, 20, 30];
|
|
assert(xs.len == 3);
|
|
};
|
|
|
|
@test fn multi_live() void = {
|
|
let xs: []i32 = [1, 2, 3];
|
|
let ys: []i32 = [4, 5];
|
|
assert(xs[0] + ys[0] == 5);
|
|
};
|
|
|
|
@test fn borrow_mut() void = {
|
|
let xs: []i32 = [1, 2, 3];
|
|
xs[1] = 99;
|
|
assert(xs[1] == 99);
|
|
};
|