Skip to content

Commit 8b2c161

Browse files
committed
Add a script to test the assembly code
1 parent a80938d commit 8b2c161

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

tests/test-encode

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#! /bin/sh
2+
3+
set -e
4+
5+
: ${INFILE=test_img.bmp}
6+
: ${OUTFILE=test_img.rfx}
7+
: ${OUTFILE_N=test_img-n.rfx}
8+
9+
test_series() {
10+
name="$1"
11+
shift
12+
count=1
13+
while test "$count" -lt 10; do
14+
echo -n "$name $count "
15+
16+
./rfxencode "$@" -c "$count" -i $INFILE -o $OUTFILE >/dev/null
17+
./rfxencode "$@" -c "$count" -i $INFILE -o $OUTFILE_N -n >/dev/null
18+
if cmp $OUTFILE $OUTFILE_N; then
19+
echo "OK"
20+
else
21+
echo "BAD!"
22+
exit 1
23+
fi
24+
25+
count=$(($count+1))
26+
done
27+
rm -f $OUTFILE $OUTFILE_N
28+
}
29+
30+
test_tiles() {
31+
name="$1"
32+
shift
33+
tile_x=90
34+
while test "$tile_x" -le 100; do
35+
tile_y=90
36+
while test "$tile_y" -le 100; do
37+
echo -n "$name ${tile_x}x${tile_y} "
38+
convert -extent "${tile_x}x${tile_y}" $INFILE tile.bmp
39+
rm -f tile.rfx tile-n.rfx
40+
./rfxencode "$@" -i tile.bmp -o tile.rfx >/dev/null
41+
./rfxencode "$@" -i tile.bmp -o tile-n.rfx -n >/dev/null
42+
if cmp tile.rfx tile-n.rfx; then
43+
echo "OK"
44+
else
45+
echo "BAD!"
46+
exit 1
47+
fi
48+
tile_y=$(($tile_y+1))
49+
done
50+
tile_x=$(($tile_x+1))
51+
done
52+
rm -f tile.bmp tile.rfx tile-n.rfx
53+
}
54+
55+
test_series "rlgr1" "-1"
56+
test_series "rlgr3"
57+
test_tiles "rlgr1" "-1"
58+
test_tiles "rlgr3"

tests/test_img.bmp

29.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)