1#!/bin/sh
2
3TMSIM="${TMSIM:-$(pwd)/../../../tmsim}"
4if [ ! -x "${TMSIM}" ]; then
5 echo "Couldn't find tmsim executable: '${TMSIM}'" 1>&2
6 exit 1
7fi
8
9exitstatus=0
10
11for test in *.csv; do
12 tmsimfile="${test%%.csv}.tm"
13
14 printf "\n"
15
16 while read -r line; do
17 input="$(echo "${line}" | cut -d ',' -f1)"
18 status="$(echo "${line}" | cut -d ',' -f2)"
19
20 echo "Testing '${test##*/}' with input '${input}':"
21 ${TMSIM} "${tmsimfile}" "${input}"
22
23 ret=$?
24 if [ ${ret} -eq ${status} ]; then
25 printf "\tOK.\n"
26 else
27 exitstatus=1
28 printf "\tFAIL: Expected '${status}', got '${ret}'.\n"
29 fi
30 done < "${test}"
31done
32
33exit ${exitstatus}