From 89e202f49b9857dcd3627fbc4e0262125d729bbc Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 04:09:39 +0200 Subject: adding all instructions and displays --- ue3/mycpu/test/memory1 | 1 + ue3/mycpu/test/program1 | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 ue3/mycpu/test/memory1 create mode 100644 ue3/mycpu/test/program1 (limited to 'ue3/mycpu/test') diff --git a/ue3/mycpu/test/memory1 b/ue3/mycpu/test/memory1 new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/ue3/mycpu/test/memory1 @@ -0,0 +1 @@ +20 diff --git a/ue3/mycpu/test/program1 b/ue3/mycpu/test/program1 new file mode 100644 index 0000000..ae5e9d2 --- /dev/null +++ b/ue3/mycpu/test/program1 @@ -0,0 +1,13 @@ +# set R2 = 10 +LOAD R2, R1 + +# start of loop +label Loop: +inc R3 +sub R4, R3, R2 +test R4 +jumpz EndLoop +write WDEZ, R3 +jumpa Loop + +label EndLoop: -- cgit v1.2.3 From 3c6f886d5a8bfd36c796b963d6e3178ad9577742 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 16:55:17 +0200 Subject: * added documentation (no more TODOs) * added testsuite + testcase * used copyctor instead of assign operator more often --- ue3/mycpu/test/test.sh | 40 ++++++++++++++++++++++++++++++++++++++++ ue3/mycpu/test/test1_memory | 1 + ue3/mycpu/test/test1_output | 19 +++++++++++++++++++ ue3/mycpu/test/test1_program | 13 +++++++++++++ 4 files changed, 73 insertions(+) create mode 100755 ue3/mycpu/test/test.sh create mode 100644 ue3/mycpu/test/test1_memory create mode 100644 ue3/mycpu/test/test1_output create mode 100644 ue3/mycpu/test/test1_program (limited to 'ue3/mycpu/test') diff --git a/ue3/mycpu/test/test.sh b/ue3/mycpu/test/test.sh new file mode 100755 index 0000000..ad2ae4d --- /dev/null +++ b/ue3/mycpu/test/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +binary="./mycpu" +tmpfile="test/tmpfile" +inputs=( $(ls test/* | grep _program | sort -n) ) + +for input in ${inputs[@]} +do + echo "Testing $input ..." + + programfile="$input" + args="-c $programfile" + memoryfile="${input/_program/_memory}" + reffile="${input/_program/_output}" + if [ -e "$memoryfile" ] + then + args+=" -m $memoryfile" + fi + + if [ ! -e "$reffile" ] + then + echo " ERROR: reference file $reffile doesn't exist" + exit 1 + fi + + rm -rf "$tmpfile" + echo " Executing $binary $args ..." + $binary $args > $tmpfile + + md5_1=$(md5sum < "$reffile") + md5_2=$(md5sum < "$tmpfile") + if [ "$md5_1" != "$md5_2" ] + then + echo " ERROR: output and $reffile differ" + diff -Nau $reffile $tmpfile + exit 1 + else + echo " SUCCESS" + fi +done 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 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 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 @@ +# set R2 = 10 +LOAD R2, R1 + +# start of loop +label Loop: +inc R3 +sub R4, R3, R2 +test R4 +jumpz EndLoop +write WDEZ, R3 +jumpa Loop + +label EndLoop: -- cgit v1.2.3 From ad6ca84f6e93f983de926ae71f31f42325986f61 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 14 May 2009 18:15:28 +0200 Subject: * making cdisplay a template * adding some asserts * adding classdiagramm and protokoll * fixing protokoll.pdf in ue1 --- ue3/mycpu/test/memory1 | 1 - ue3/mycpu/test/program1 | 13 ------------- ue3/mycpu/test/test.sh | 4 +++- 3 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 ue3/mycpu/test/memory1 delete mode 100644 ue3/mycpu/test/program1 (limited to 'ue3/mycpu/test') diff --git a/ue3/mycpu/test/memory1 b/ue3/mycpu/test/memory1 deleted file mode 100644 index 209e3ef..0000000 --- a/ue3/mycpu/test/memory1 +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/ue3/mycpu/test/program1 b/ue3/mycpu/test/program1 deleted file mode 100644 index ae5e9d2..0000000 --- a/ue3/mycpu/test/program1 +++ /dev/null @@ -1,13 +0,0 @@ -# set R2 = 10 -LOAD R2, R1 - -# start of loop -label Loop: -inc R3 -sub R4, R3, R2 -test R4 -jumpz EndLoop -write WDEZ, R3 -jumpa Loop - -label EndLoop: diff --git a/ue3/mycpu/test/test.sh b/ue3/mycpu/test/test.sh index ad2ae4d..ff1076c 100755 --- a/ue3/mycpu/test/test.sh +++ b/ue3/mycpu/test/test.sh @@ -32,9 +32,11 @@ do if [ "$md5_1" != "$md5_2" ] then echo " ERROR: output and $reffile differ" - diff -Nau $reffile $tmpfile + diff -Naur "$reffile" "$tmpfile" + rm -rf "$tmpfile" exit 1 else echo " SUCCESS" fi + rm -rf "$tmpfile" done -- cgit v1.2.3