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

exe=$1
cases=(
  string_plus_int
  int_plus_string
  bool_plus_string
  string_concat_int
  bool_concat_string
)

for case_name in "${cases[@]}"; do
  core_out=$("$exe" core "$case_name")
  php_out=$("$exe" php "$case_name")
  if [ "$core_out" != "$php_out" ]; then
    printf 'zval/runtime mismatch for %s\ncore: %s\nphp:  %s\n' "$case_name" "$core_out" "$php_out" >&2
    exit 1
  fi
  printf 'ok - %s => %s\n' "$case_name" "$core_out"
done
