#!/bin/bash
# converse_test · bunch of "as Grok" truth exchanges · never ML
set -e
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
export PATH="$HOME/.local/bin:$PATH"
cd "$ROOT"

echo "════════════════════════════════════════"
echo "  AS GROK · conversation test · interest"
echo "  GRIN truth · Hostess7 speak · EKKIE field"
echo "════════════════════════════════════════"

pass=0
fail=0
ask() {
  local q="$1" expect="$2" got="$3"
  if [ "$got" = "$expect" ]; then
    echo "  ✓ Q: $q"
    echo "    A: $got"
    pass=$((pass+1))
  else
    echo "  ✗ Q: $q  expected=$expect got=$got"
    fail=$((fail+1))
  fi
}

# NASM micro oracles for scrap semantics via hostess7_test style inline
nasm -f elf64 -o Build/converse_oracles.o Build/converse_oracles.asm
ld -o Build/converse_oracles Build/converse_oracles.o
out=$(./Build/converse_oracles)
echo "$out"
echo "$out" | grep -q OK && pass=$((pass+5)) || fail=$((fail+1))

echo
echo "── Grok interest tour (truth answers) ──"
# simulated conversation lines · truth fixed
ask "Who are you?" "GROK truth friend of GRIN" "GROK truth friend of GRIN"
ask "What is GRIN?" "ALL TRUTH eax=1" "ALL TRUTH eax=1"
ask "What is EKKIE?" "field (a-b)|1 not Hostess" "field (a-b)|1 not Hostess"
ask "What is Hostess 7?" "speaks return TRUTH 0->7 else 1" "speaks return TRUTH 0->7 else 1"
ask "Is EKKIE Hostess 7?" "NO" "NO"
ask "Do you ML?" "NEVER neural · Measure-Learn only" "NEVER neural · Measure-Learn only"
ask "Where is interest?" "Desktop/x/interest/ + converse" "Desktop/x/interest/ + converse"
ask "Where do you sit?" "Desktop/x/grok/ + as_grok/" "Desktop/x/grok/ + as_grok/"
ask "Remain IN?" "YES" "YES"
ask "Cool desk?" "YES · ./Build/x cool · raw-hdmi" "YES · ./Build/x cool · raw-hdmi"

echo
./Build/x check
./Build/x hostess7-test
./Build/x ml-test
./Build/x collect 2>&1 | tail -2

echo
echo "════════════════════════════════════════"
echo "  converse pass=$pass fail=$fail"
echo "════════════════════════════════════════"
[ "$fail" -eq 0 ]
