Files
ww/test/lang/arr_u16_store_test.ww
Hojun-Cho 83f5956df2 test: banner purge + WHY-only comment sweep (rule 8)
Every section banner dies (103 -> 0) across test/lang, the observer
suites, the C carriers, and the five comment-heavy corpus fixtures;
banner provenance (#N cites, carrier numbers, repair-cluster labels)
folded into headers or adjacent WHY comments. Narration deleted; row
provenance, ref cites, divergence pins, and layout contracts kept
(fwd-ref decl-order guards and bootstrap-gate corpus rationale
restored where the sweep over-cut). Comment-only proven: all 3742
wwbuild workdir .s byte-identical before/after; test-commit and
test-byteid (161 lang + 1399 data, 0 pinned-divergent) green.
2026-08-08 21:40:23 +09:00

42 lines
1.3 KiB
Plaintext

// [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);
};