Files
ww/test/lang/continue_test.ww
Hojun-Cho 132ea4ee60 test: migrate Fam13 misc checker/coercion value tests to @test (#5-C6)
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.
2026-06-24 22:59:32 +09:00

53 lines
1.3 KiB
Plaintext

// continue_test — #138: `continue` in a loop with a post-step must run the
// post-step BEFORE re-testing the cond/bound. Migrated from
// test/wcc/911_continue_run.c (value rows; cs==ww byte-id rides T2).
//
// Pre-fix the continue-target was the loop top, SKIPPING the post-step, so the
// value that triggered continue never advanced → infinite loop. Both stages
// emitted identical buggy asm, so the byte-id gate was blind; the runtime
// readback (count/sum mismatch, or a hang) is the net. The 1-clause row pins
// the no-post-step shape stays unchanged (cont-target = loop top).
package continue_test;
@test fn for3_skip_one() void = {
let count: i32 = 0;
for (let i: i32 = 0; i < 5; i += 1) {
if (i == 2) { continue; };
count += 1;
};
assert(count == 4);
};
@test fn for3_skip_two() void = {
let c: i32 = 0;
for (let i: i32 = 0; i < 5; i += 1) {
if (i == 1) { continue; };
if (i == 3) { continue; };
c += 10;
};
assert(c == 30);
};
@test fn range_skip() void = {
let xs: [5]i32 = [10, 20, 30, 40, 50];
let sum: i32 = 0;
for (let v .. xs) {
if (v == 30) { continue; };
sum += v;
};
assert(sum == 120);
};
@test fn for1_continue_byteid() void = {
let count: i32 = 0;
let i: i32 = 0;
for (i < 5) {
let cur: i32 = i;
i += 1;
if (cur == 2) { continue; };
count += 1;
};
assert(count == 4);
};