summaryrefslogtreecommitdiffstats
path: root/ue3/mycpu/test
diff options
context:
space:
mode:
authormanuel <manuel@nc8430.lan>2009-05-14 18:58:48 +0200
committermanuel <manuel@nc8430.lan>2009-05-14 18:58:48 +0200
commit53b68ac658569dea3f5a26745dacf2a9aca0b266 (patch)
tree269af83394e84e2a7142dde87fb15dce413aa5c9 /ue3/mycpu/test
parentddf63e2765a6b225d18c59321595e69e1a126e0c (diff)
parent3563c6dfd0f5f102cb748ecc6ad318601990515e (diff)
downloadooprog-53b68ac658569dea3f5a26745dacf2a9aca0b266.tar.gz
ooprog-53b68ac658569dea3f5a26745dacf2a9aca0b266.tar.bz2
ooprog-53b68ac658569dea3f5a26745dacf2a9aca0b266.zip
trying merging cpu-mm with default branch
Diffstat (limited to 'ue3/mycpu/test')
-rwxr-xr-xue3/mycpu/test/test.sh42
-rw-r--r--ue3/mycpu/test/test1_memory1
-rw-r--r--ue3/mycpu/test/test1_output19
-rw-r--r--ue3/mycpu/test/test1_program13
-rw-r--r--ue3/mycpu/test/test_prog15
-rw-r--r--ue3/mycpu/test/test_prog_mem6
6 files changed, 75 insertions, 21 deletions
diff --git a/ue3/mycpu/test/test.sh b/ue3/mycpu/test/test.sh
new file mode 100755
index 0000000..ff1076c
--- /dev/null
+++ b/ue3/mycpu/test/test.sh
@@ -0,0 +1,42 @@
1#!/bin/bash
2
3binary="./mycpu"
4tmpfile="test/tmpfile"
5inputs=( $(ls test/* | grep _program | sort -n) )
6
7for input in ${inputs[@]}
8do
9 echo "Testing $input ..."
10
11 programfile="$input"
12 args="-c $programfile"
13 memoryfile="${input/_program/_memory}"
14 reffile="${input/_program/_output}"
15 if [ -e "$memoryfile" ]
16 then
17 args+=" -m $memoryfile"
18 fi
19
20 if [ ! -e "$reffile" ]
21 then
22 echo " ERROR: reference file $reffile doesn't exist"
23 exit 1
24 fi
25
26 rm -rf "$tmpfile"
27 echo " Executing $binary $args ..."
28 $binary $args > $tmpfile
29
30 md5_1=$(md5sum < "$reffile")
31 md5_2=$(md5sum < "$tmpfile")
32 if [ "$md5_1" != "$md5_2" ]
33 then
34 echo " ERROR: output and $reffile differ"
35 diff -Naur "$reffile" "$tmpfile"
36 rm -rf "$tmpfile"
37 exit 1
38 else
39 echo " SUCCESS"
40 fi
41 rm -rf "$tmpfile"
42done
diff --git a/ue3/mycpu/test/test1_memory b/ue3/mycpu/test/test1_memory
new file mode 100644
index 0000000..209e3ef
--- /dev/null
+++ b/ue3/mycpu/test/test1_memory
@@ -0,0 +1 @@
20
diff --git a/ue3/mycpu/test/test1_output b/ue3/mycpu/test/test1_output
new file mode 100644
index 0000000..ac30dc2
--- /dev/null
+++ b/ue3/mycpu/test/test1_output
@@ -0,0 +1,19 @@
11
22
33
44
55
66
77
88
99
1010
1111
1212
1313
1414
1515
1616
1717
1818
1919
diff --git a/ue3/mycpu/test/test1_program b/ue3/mycpu/test/test1_program
new file mode 100644
index 0000000..ae5e9d2
--- /dev/null
+++ b/ue3/mycpu/test/test1_program
@@ -0,0 +1,13 @@
1# set R2 = 10
2LOAD R2, R1
3
4# start of loop
5label Loop:
6inc R3
7sub R4, R3, R2
8test R4
9jumpz EndLoop
10write WDEZ, R3
11jumpa Loop
12
13label EndLoop:
diff --git a/ue3/mycpu/test/test_prog b/ue3/mycpu/test/test_prog
deleted file mode 100644
index b50575b..0000000
--- a/ue3/mycpu/test/test_prog
+++ /dev/null
@@ -1,15 +0,0 @@
1# set R2 = 10
2
3load R2, R1
4
5# start of loop
6label Loop:
7inc R3
8sub R4, R3, R2
9test R4
10jumpz EndLoop
11write WDEZ, R3
12store R3, R1
13jumpa Loop
14
15label EndLoop:
diff --git a/ue3/mycpu/test/test_prog_mem b/ue3/mycpu/test/test_prog_mem
deleted file mode 100644
index 8c3e80f..0000000
--- a/ue3/mycpu/test/test_prog_mem
+++ /dev/null
@@ -1,6 +0,0 @@
19
23
34
45
54
63