+#!/bin/bash
+set -e
+shopt -s nullglob
+
+make minfp
+
+[ $# -eq 0 ] && testfiles=(tests/*.mfp) || testfiles=("${@}")
+
+pass=0
+skip=0
+fail=0
+for t in "${testfiles[@]}"; do
+ if [ ! -f "$t" ]; then
+ echo "$t doesn't exist" >&2
+ exit 1
+ fi
+
+ exp="${t/%.mfp/.expected}"
+ if [ ! -f "$exp" ]; then
+ echo "$exp doesn't exist, skipping" >&2
+ skip=$((skip+1))
+ else
+ diff <(./minfp < "$t") "$exp"
+ [ $? -ne 0 ] && fail=$((fail+1)) || pass=$((pass+1))
+ fi
+done
+echo "passed : $pass" >&2
+echo "skipped: $skip" >&2
+echo "failed : $fail" >&2