local_zeroinit_test.ww takes the 840/944 zero-init seam (dirty-frame prime and probe share one @test because the runtime forks per test); alias_cgen_b6, alloc_nested_field, array_static_init, and strarray_static gain the rows their retired wrappers held; the remaining files re-point reject-row citations at the r788_* and stage-matrix fixtures.
60 lines
1.6 KiB
Plaintext
60 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, including the
|
|
// stage-asymmetric assignment diagnostic, live 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);
|
|
};
|