#!/usr/bin/env bash # test.sh - Test harness for the exported Micro Distillery model. set -euo pipefail cd "$(dirname "$0")" PY="${PYTHON:-python3}" echo "================================================" echo " Micro Distillery - Model Test Harness" echo "================================================" echo "" if ! command -v "$PY" >/dev/null 2>&1; then echo "ERROR: $PY not found. Install Python 3.8+." >&2 echo " macOS: brew install python3" >&2 echo " Ubuntu: sudo apt install python3" >&2 echo " Windows: https://python.org/downloads/" >&2 exit 1 fi echo "[1/3] Python: $($PY --version 2>&1)" if [ ! -f model.json ]; then echo "ERROR: model.json not found in $(pwd)" >&2 exit 1 fi echo "[2/3] Found model.json" $PY -c " import json m = json.load(open('model.json')) assert 'transitions' in m, 'missing transitions' assert 'vocab' in m, 'missing vocab' print('OK: format=%s vocab=%d transitions=%d' % (m.get('format','?'), len(m['vocab']), len(m['transitions']))) " echo "[3/3] Model validation passed" echo "" echo "=== Sample Generations ===" for prompt in alice bob zoe liam; do echo -n " $prompt -> " $PY test.py "$prompt" 2>/dev/null | tail -1 || echo "(failed)" done echo "" echo "=== Interactive Chat (type /quit to exit) ===" exec $PY test.py