summaryrefslogtreecommitdiffstats
path: root/test.sh
blob: 4a511e29dc7409b59d297eed29d6be7f95421fed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

for f in test/*.asm; do
	base=$(echo "$f" | cut -d. -f1)
	args=""
	for i in $base.in.*; do
		c=$(echo "$i" | cut -d. -f3)
		args="$args --in.$c $i"
	done
	for i in $base.out.*; do
		c=$(echo "$i" | cut -d. -f3)
		args="$args --out.$c /tmp/tis100-test.out.$c"
	done
	./tis100 "$f" $args
	if [ $? -ne 0 ]; then
		echo "$f"
	else
		bad=0
		for c in "abcdefghijklmnopqrstuvwyxz"; do
			out="$base.in.$c"
			tmp="/tmp/tis100-test.out.$c"
			if [ -e "$out" -a -e "$tmp" ] && ! diff "$out" "$tmp"; then
				cat "$tmp" | xxd 1>&2
				cat "$out" | xxd 1>&2
				bad=1
			fi
		done
		[ $bad -ne 0 ] && echo "$f"
	fi
done
: