Files
ww/test/lang/arr_u16_store_test.ww
Hojun-Cho 74cc35d488 test: migrate Fam4 static-init/DATA-emit value tests to @test (#30)
Continues the test-arch tower past Fam8-13. 11 module-level static-init
/ DATA-emit value drivers move from test/wcc/*_run.c into @test row-
tables under test/lang/; every classification empirically re-probed at
HEAD (refuting two stale worklist tags).

- value rows -> test/lang/*_test.ww (11 files)
- reject rows -> runww //ww:error carriers (3, dual-stage non-vacuous;
  947 const-divzero confirmed a both-stage compile-reject, not run-exit)
- 840_zeroinit, 944_array_zeroinit, 989_arrlit_tail_zero kept as byte-id
  .c pins (zero-over-dirtied-frame / DATAW-length is byte-id-blind to a
  runtime @test; #263), mutation-gated
- repoint two stale comment refs to deleted test names (719,
  989_structlocal_frame)

Migrated static-init @test ride the cs==ww T2 byte-id gate, preserving
DATA-emit byte-id. 2D global-struct array-field read (#137/#150)
confirmed cs==ww + correct at HEAD. Coverage parity verified row-by-row;
two-round reviewed. Floor ratchet follows.
2026-06-25 01:32:32 +09:00

42 lines
1.3 KiB
Plaintext

// arr_u16_store_test — [N]u16/[N]i16 array-literal init stores MOVW per slot.
// Migrated from test/wcc/914_arr_u16_store_run.c. Pre-fix a [4]u16 init emitted
// overlapping MOVQ stores (accident-corrected for some values); the fix dispatches
// a proper MOVW per 2-byte slot (op chosen by esz, not signedness). cstage
// build+run was T1; cs==ww .s byte-id rides T2 (test-lang-byteid). The full_init
// row asserts each element to catch any value drift; the [4]u8 control pins the
// MOVB path is unchanged; i16_signed pins the dispatch is not signedness-gated.
package arr_u16_store_test;
@test fn u16_full_init() void = {
let a: [4]u16 = [0xABCDu16, 0xBEEFu16, 0xC0DEu16, 0xDEADu16];
assert(a[0] == 0xABCDu16);
assert(a[1] == 0xBEEFu16);
assert(a[2] == 0xC0DEu16);
assert(a[3] == 0xDEADu16);
};
@test fn u16_small_values() void = {
let a: [4]u16 = [10u16, 20u16, 30u16, 40u16];
let s: i32 = 0;
s += a[0]: i32; s += a[1]: i32;
s += a[2]: i32; s += a[3]: i32;
assert(s == 100);
};
@test fn u8_control() void = {
let a: [4]u8 = [10u8, 20u8, 30u8, 40u8];
let s: i32 = 0;
s += a[0]: i32; s += a[1]: i32;
s += a[2]: i32; s += a[3]: i32;
assert(s == 100);
};
@test fn i16_signed() void = {
let a: [4]i16 = [10i16, 20i16, 30i16, -5i16];
let s: i32 = 0;
s += a[0]: i32; s += a[1]: i32;
s += a[2]: i32; s += a[3]: i32;
assert(s == 55);
};