#! /bin/sh

# To use this script, set CC
# and CFLAGS.

set -e
set -u

t=$1

cat $t

set -x

if ! $CC $CFLAGS "$t" -o "$t.bin"
then
    exit 1
fi

if ! "$t.bin" > "$t.output" 2>&1
then
    exit 1
fi

if ! diff -u "$t.expected" "$t.output"
then
    exit 1
fi
