test: Phase 100 string accumulator fixture+smokes (VM+LLVM)

- Add phase100_string_accumulator_min.hako fixture
  * out = out + ch string accumulation
  * print(out.length()) for stable numeric output
- Add VM smoke: phase100_string_accumulator_vm.sh
- Add LLVM EXE smoke: phase100_string_accumulator_llvm_exe.sh (Phase 97 gating)
- Regression: all phase100/97/94 tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-17 16:33:26 +09:00
parent 27fd9720d0
commit dfc01f4dc5
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,15 @@
static box Main {
main() {
local out = ""
local s = "abc"
local i = 0
loop(i < 3) {
if i >= 3 { break }
local ch = s.substring(i, i + 1)
out = out + ch
i = i + 1
}
print(out.length())
return 0
}
}

View File

@ -0,0 +1,49 @@
#!/bin/bash
# Phase 100 P3 - String Accumulator (LLVM EXE backend)
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../../../../../.." && pwd)"
cd "$REPO_ROOT"
HAKO_FILE="apps/tests/phase100_string_accumulator_min.hako"
EXPECTED_OUTPUT="3"
# Phase 97 plugin gating pattern
if [ ! -f "target/release/plugins/.dlopen_cache" ]; then
echo "⏭️ SKIP: phase100_string_accumulator_llvm_exe (plugins not built)"
exit 0
fi
# Build LLVM exe
if ! tools/build_llvm.sh "$HAKO_FILE" > /tmp/phase100_string_acc_build.log 2>&1; then
echo "⚠️ SKIP: phase100_string_accumulator_llvm_exe (LLVM build failed)"
cat /tmp/phase100_string_acc_build.log | tail -n 20
exit 0
fi
EXE_PATH="/tmp/phase100_string_accumulator_min"
if [ ! -f "$EXE_PATH" ]; then
echo "❌ FAIL: phase100_string_accumulator_llvm_exe (exe not found)"
exit 1
fi
# Run exe and extract numeric output
ACTUAL_OUTPUT=$("$EXE_PATH" 2>&1 | grep -v '^\[' | grep -v 'Net plugin' | grep -v 'RC:' | grep -E '^[0-9]+$')
if [ "$ACTUAL_OUTPUT" = "$EXPECTED_OUTPUT" ]; then
echo "✅ PASS: phase100_string_accumulator_llvm_exe"
exit 0
else
echo "❌ FAIL: phase100_string_accumulator_llvm_exe"
echo "Expected:"
echo "$EXPECTED_OUTPUT"
echo "Got:"
echo "$ACTUAL_OUTPUT"
echo "---Full output (last 80 lines):---"
"$EXE_PATH" 2>&1 | tail -n 80
exit 1
fi

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Phase 100 P3 - String Accumulator (VM backend)
HAKO_FILE="apps/tests/phase100_string_accumulator_min.hako"
BACKEND="vm"
EXPECTED_OUTPUT="3"
ACTUAL_OUTPUT=$(HAKO_JOINIR_STRICT=1 ./target/release/hakorune --backend "$BACKEND" "$HAKO_FILE" 2>&1 | grep -v '^\[' | grep -v 'Net plugin' | grep -v 'RC:' | grep -E '^[0-9]+$')
if [ "$ACTUAL_OUTPUT" = "$EXPECTED_OUTPUT" ]; then
echo "✅ PASS: phase100_string_accumulator_vm"
exit 0
else
echo "❌ FAIL: phase100_string_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