#!/bin/sh

run() {
	prog=$1
	desired=$2
	out=`./build/resp $prog`
	if [ "$out" != "$desired" ]; then
		echo "FAIL: $prog";
		echo "    Expected: \"$desired\"";
		echo "    Output:   \"$out\"";
	else
		echo "PASS: $prog"
	fi
}

# Basic lexical sanity
run './test/def.resp'         '4 : Int'
run './test/deffn.resp'       '3 : Int'
run './test/inlinefn.resp'    '2 : Int'
run './test/nest.resp'        '8 : Int'

# Basic data types
run './test/string.resp'      '"Hello, world!" : String'
run './test/tup.resp'         '5 : Int'

# Recursive arithmetic functions
run './test/fac.resp'         '720 : Int'
run './test/ack.resp'         '8189 : Int'

# Closures
run './test/closure.resp'     '6 : Int'
run './test/let-over-fn.resp' '2 : Int'
run './test/let.resp'         '5 : Int'

# Algebraic data types
run './test/match.resp'       '12.0000 : Float'

#run './test/poly.resp' '#t : Bool'