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 output="$(echo "${line}" | cut -d ',' -f2)"
19
20 echo "Testing '${test##*/}' with input '${input}':"
21 result=$(${TMSIM} -r "${tmsimfile}" "${input}" | tr -d \$)
22
23 if [ "${result}" = "${output}" ]; then
24 printf "\tOK.\n"
25 else
26 exitstatus=1
27 printf "\tFAIL: Expected '${output}', got '${result}'.\n"
28 fi
29 done < "${test}"
30done
31
32exit ${exitstatus}