From 536e6280c52134c5668180bf99ec499db3e70fb9 Mon Sep 17 00:00:00 2001 From: nyash-codex Date: Wed, 17 Dec 2025 06:10:59 +0900 Subject: [PATCH] test: Phase 100 mutable accumulator fixture + smoke (numeric validation) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add apps/tests/phase100_mutable_accumulator_min.hako * Pattern2 with break (if i >= 3 { break }) * Two accumulators: out = out + ch (string), count = count + 1 (integer) * print(count) for stable numeric output - Add phase100_mutable_accumulator_vm.sh smoke test * HAKO_JOINIR_STRICT=1 validation * Numeric-only output extraction (expected: 3) - Regression: all phase100/96/94 tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../phase100_mutable_accumulator_min.hako | 16 +++++++++++++ .../apps/phase100_mutable_accumulator_vm.sh | 23 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 apps/tests/phase100_mutable_accumulator_min.hako create mode 100644 tools/smokes/v2/profiles/integration/apps/phase100_mutable_accumulator_vm.sh diff --git a/apps/tests/phase100_mutable_accumulator_min.hako b/apps/tests/phase100_mutable_accumulator_min.hako new file mode 100644 index 00000000..58e63832 --- /dev/null +++ b/apps/tests/phase100_mutable_accumulator_min.hako @@ -0,0 +1,16 @@ +static box Main { + main() { + local out = "" + local count = 0 + local i = 0 + loop(i < 10) { + if i >= 3 { break } + local ch = "x" + out = out + ch + count = count + 1 + i = i + 1 + } + print(count) + return 0 + } +} diff --git a/tools/smokes/v2/profiles/integration/apps/phase100_mutable_accumulator_vm.sh b/tools/smokes/v2/profiles/integration/apps/phase100_mutable_accumulator_vm.sh new file mode 100644 index 00000000..5becfe32 --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase100_mutable_accumulator_vm.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Phase 100 P2 - Mutable Accumulator (VM backend) +# Tests: out = out + ch (string accumulator) and count = count + 1 (integer accumulator) + +HAKO_FILE="apps/tests/phase100_mutable_accumulator_min.hako" +BACKEND="vm" +EXPECTED_OUTPUT="3" + +ACTUAL_OUTPUT=$(HAKO_JOINIR_STRICT=1 ./target/release/hakorune --backend "$BACKEND" "$HAKO_FILE" 2>&1 | grep -E '^[0-9]+$') + +if [ "$ACTUAL_OUTPUT" = "$EXPECTED_OUTPUT" ]; then + echo "✅ PASS: phase100_mutable_accumulator_vm" + exit 0 +else + echo "❌ FAIL: phase100_mutable_accumulator_vm" + echo "Expected:" + echo "$EXPECTED_OUTPUT" + echo "Got:" + echo "$ACTUAL_OUTPUT" + echo "---Full output (last 80 lines):---" + HAKO_JOINIR_STRICT=1 ./target/release/hakorune --backend "$BACKEND" "$HAKO_FILE" 2>&1 | tail -n 80 + exit 1 +fi