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.
54 lines
1.6 KiB
Plaintext
54 lines
1.6 KiB
Plaintext
// strarray_static_test — module-level [N]str static-init: per-element .len
|
|
// header sums + per-element .ptr RELOC dereferenced to chars. Migrated from
|
|
// test/wcc/919_strarray_static_run.c. cstage build+run was T1; cs==ww .s byte-id
|
|
// rides T2 (test-lang-byteid).
|
|
//
|
|
// drew: assert THROUGH the per-element .ptr deref (not just .len) — a reloc-blind
|
|
// .len-only check would miss a wrong/swapped element relocation. The empty-slot
|
|
// and `...` repeat-suffix rows pin that an empty element doesn't shift the
|
|
// following element's reloc and that the repeat-fill row's DATAR resolves to the
|
|
// last explicit element. The under-length row separately pins that omitted
|
|
// elements have zero-length headers rather than replaying the last string.
|
|
|
|
package strarray_static_test;
|
|
|
|
let TLEN: [3]str = ["ab", "cde", "f"];
|
|
let TPTR: [3]str = ["A", "B", "C"];
|
|
let TVAR: [3]str = ["xx", "yyy", "z"];
|
|
let TEMP: [2]str = ["", "Z"];
|
|
let TREP: [3]str = ["X", "Y"...];
|
|
let TTAIL: [4]str = ["ab", "cde"];
|
|
|
|
@test fn strtab_len() void = {
|
|
assert((TLEN[0].len + TLEN[1].len + TLEN[2].len): i32 == 6);
|
|
};
|
|
|
|
@test fn strtab_ptr_elem2() void = {
|
|
let p: *u8 = TPTR[2].ptr;
|
|
assert((*p): i32 == 67);
|
|
};
|
|
|
|
@test fn strtab_ptr_varindex() void = {
|
|
let i: i32 = 1;
|
|
let p: *u8 = TVAR[i].ptr;
|
|
assert((*p): i32 == 121);
|
|
};
|
|
|
|
@test fn strtab_empty_then_ptr() void = {
|
|
assert(TEMP[0].len == 0);
|
|
let p: *u8 = TEMP[1].ptr;
|
|
assert((*p): i32 == 90);
|
|
};
|
|
|
|
@test fn strtab_repeat_suffix() void = {
|
|
let p: *u8 = TREP[2].ptr;
|
|
assert((*p): i32 == 89);
|
|
};
|
|
|
|
@test fn strtab_zero_tail() void = {
|
|
assert(TTAIL[0].len == 2);
|
|
assert(TTAIL[1].len == 3);
|
|
assert(TTAIL[2].len == 0);
|
|
assert(TTAIL[3].len == 0);
|
|
};
|