#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BIN="$ROOT/flowlog"

make -C "$ROOT" -s >/dev/null

out="$(
  printf '%s\n' \
    '[bench/nqueens_length].' \
    'queens_solutions(4,2).' \
    'halt.' \
  | "$BIN" --threads 1 \
  | tr -d '\r'
)"

if ! printf '%s\n' "$out" | grep -Eq '^true$'; then
  echo "--- expected output containing ---" >&2
  echo "true" >&2
  echo "--- got ---" >&2
  printf '%s\n' "$out" >&2
  exit 1
fi
