From f7bc61e874ebde2e29dad4075ab3834d78998df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= Date: Wed, 5 Jun 2019 20:48:27 +0200 Subject: [PATCH] Automatic tests for input from stdin --- test/asm/bank-noexist.out.pipe | 0 test/asm/divzero-instr.out.pipe | 2 ++ test/asm/divzero-section-bank.out.pipe | 4 +++ test/asm/equ-charmap.out.pipe | 0 test/asm/label-redefinition.out.pipe | 3 ++ test/asm/line-continuation.out.pipe | 2 ++ test/asm/local-wrong-parent.out.pipe | 3 ++ test/asm/macro-@.out.pipe | 2 ++ test/asm/narg-decreases-after-shift.out.pipe | 0 test/asm/null-in-macro.out.pipe | 2 ++ test/asm/reference-undefined-sym.out.pipe | 3 ++ test/asm/remote-local-explicit.out.pipe | 0 test/asm/remote-local-noexist.out.pipe | 2 ++ test/asm/remote-local.out.pipe | 0 test/asm/strlen.out.pipe | 2 ++ test/asm/strsub.out.pipe | 31 ++++++++++++++++++++ test/asm/test.sh | 29 +++++++++++------- test/asm/undefined-dot.out.pipe | 1 + test/asm/utf-8.out.pipe | 0 19 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 test/asm/bank-noexist.out.pipe create mode 100644 test/asm/divzero-instr.out.pipe create mode 100644 test/asm/divzero-section-bank.out.pipe create mode 100644 test/asm/equ-charmap.out.pipe create mode 100644 test/asm/label-redefinition.out.pipe create mode 100644 test/asm/line-continuation.out.pipe create mode 100644 test/asm/local-wrong-parent.out.pipe create mode 100644 test/asm/macro-@.out.pipe create mode 100644 test/asm/narg-decreases-after-shift.out.pipe create mode 100644 test/asm/null-in-macro.out.pipe create mode 100644 test/asm/reference-undefined-sym.out.pipe create mode 100644 test/asm/remote-local-explicit.out.pipe create mode 100644 test/asm/remote-local-noexist.out.pipe create mode 100644 test/asm/remote-local.out.pipe create mode 100644 test/asm/strlen.out.pipe create mode 100644 test/asm/strsub.out.pipe create mode 100644 test/asm/undefined-dot.out.pipe create mode 100644 test/asm/utf-8.out.pipe diff --git a/test/asm/bank-noexist.out.pipe b/test/asm/bank-noexist.out.pipe new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/divzero-instr.out.pipe b/test/asm/divzero-instr.out.pipe new file mode 100644 index 00000000..6a9391a4 --- /dev/null +++ b/test/asm/divzero-instr.out.pipe @@ -0,0 +1,2 @@ +ERROR: -(2): + Division by zero diff --git a/test/asm/divzero-section-bank.out.pipe b/test/asm/divzero-section-bank.out.pipe new file mode 100644 index 00000000..51764978 --- /dev/null +++ b/test/asm/divzero-section-bank.out.pipe @@ -0,0 +1,4 @@ +ERROR: -(1): + Invalid integer constant +ERROR: -(1): + Division by zero diff --git a/test/asm/equ-charmap.out.pipe b/test/asm/equ-charmap.out.pipe new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/label-redefinition.out.pipe b/test/asm/label-redefinition.out.pipe new file mode 100644 index 00000000..ef695055 --- /dev/null +++ b/test/asm/label-redefinition.out.pipe @@ -0,0 +1,3 @@ +ERROR: -(7): + 'Sym' already defined in m(6) +error: Assembly aborted (1 errors)! diff --git a/test/asm/line-continuation.out.pipe b/test/asm/line-continuation.out.pipe new file mode 100644 index 00000000..75ca5841 --- /dev/null +++ b/test/asm/line-continuation.out.pipe @@ -0,0 +1,2 @@ +ERROR: -(2) -> @(-1): + Macro '@' not defined diff --git a/test/asm/local-wrong-parent.out.pipe b/test/asm/local-wrong-parent.out.pipe new file mode 100644 index 00000000..220ddf9e --- /dev/null +++ b/test/asm/local-wrong-parent.out.pipe @@ -0,0 +1,3 @@ +ERROR: -(5): + Not currently in the scope of 'WrongParent' +error: Assembly aborted (1 errors)! diff --git a/test/asm/macro-@.out.pipe b/test/asm/macro-@.out.pipe new file mode 100644 index 00000000..725c38be --- /dev/null +++ b/test/asm/macro-@.out.pipe @@ -0,0 +1,2 @@ +ERROR: -(1) -> @(-1): + Macro '@' not defined diff --git a/test/asm/narg-decreases-after-shift.out.pipe b/test/asm/narg-decreases-after-shift.out.pipe new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/null-in-macro.out.pipe b/test/asm/null-in-macro.out.pipe new file mode 100644 index 00000000..f3f8d1fb --- /dev/null +++ b/test/asm/null-in-macro.out.pipe @@ -0,0 +1,2 @@ +ERROR: -(1): + Unterminated MACRO definition. diff --git a/test/asm/reference-undefined-sym.out.pipe b/test/asm/reference-undefined-sym.out.pipe new file mode 100644 index 00000000..dae036c0 --- /dev/null +++ b/test/asm/reference-undefined-sym.out.pipe @@ -0,0 +1,3 @@ +ERROR: -(4): + 'X' already referenced at -(2) +error: Assembly aborted (1 errors)! diff --git a/test/asm/remote-local-explicit.out.pipe b/test/asm/remote-local-explicit.out.pipe new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/remote-local-noexist.out.pipe b/test/asm/remote-local-noexist.out.pipe new file mode 100644 index 00000000..c096a468 --- /dev/null +++ b/test/asm/remote-local-noexist.out.pipe @@ -0,0 +1,2 @@ +ERROR: -(7): + 'Parent.child.fail' is a nonsensical reference to a nested local symbol diff --git a/test/asm/remote-local.out.pipe b/test/asm/remote-local.out.pipe new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/strlen.out.pipe b/test/asm/strlen.out.pipe new file mode 100644 index 00000000..18620f97 --- /dev/null +++ b/test/asm/strlen.out.pipe @@ -0,0 +1,2 @@ +$3 +$4 diff --git a/test/asm/strsub.out.pipe b/test/asm/strsub.out.pipe new file mode 100644 index 00000000..15e474cf --- /dev/null +++ b/test/asm/strsub.out.pipe @@ -0,0 +1,31 @@ +warning: -(13) -> xstrsub(1): + STRSUB: Length too big: 32 +warning: -(14) -> xstrsub(1): + STRSUB: Length too big: 300 +warning: -(15) -> xstrsub(1): + STRSUB: Position starts at 1 +warning: -(15) -> xstrsub(1): + STRSUB: Length too big: 300 +warning: -(16) -> xstrsub(1): + STRSUB: Position 4 is past the end of the string +warning: -(17) -> xstrsub(1): + STRSUB: Position 4 is past the end of the string +warning: -(17) -> xstrsub(1): + STRSUB: Length too big: 1 +warning: -(20) -> xstrsub(1): + STRSUB: Length too big: 10 +A +B +C +AB +BC +BC +BC +ABC + + +カタ +カナ +カナ +g +g̈ diff --git a/test/asm/test.sh b/test/asm/test.sh index cfd127df..da050652 100755 --- a/test/asm/test.sh +++ b/test/asm/test.sh @@ -6,18 +6,25 @@ after=$(mktemp) rc=0 for i in *.asm; do - ../../rgbasm -o $o $i > $after 2>&1 - diff -u ${i%.asm}.out $after - rc=$(($? || $rc)) - bin=${i%.asm}.out.bin - if [ -f $bin ]; then - ../../rgblink -o $gb $o > $after 2>&1 - head -c $(wc -c < $bin) $gb > $after 2>&1 - hexdump -C $after > $before && mv $before $after - hexdump -C $bin > $before - diff -u $before $after + for variant in '' '.pipe'; do + if [ -z "$variant" ]; then + ../../rgbasm -o $o $i > $after 2>&1 + else + cat $i | ../../rgbasm -o $o - > $after 2>&1 + fi + + diff -u ${i%.asm}.out$variant $after rc=$(($? || $rc)) - fi + bin=${i%.asm}.out.bin + if [ -f $bin ]; then + ../../rgblink -o $gb $o > $after 2>&1 + head -c $(wc -c < $bin) $gb > $after 2>&1 + hexdump -C $after > $before && mv $before $after + hexdump -C $bin > $before + diff -u $before $after + rc=$(($? || $rc)) + fi + done done rm -f $o $gb $before $after diff --git a/test/asm/undefined-dot.out.pipe b/test/asm/undefined-dot.out.pipe new file mode 100644 index 00000000..888222b3 --- /dev/null +++ b/test/asm/undefined-dot.out.pipe @@ -0,0 +1 @@ +error: -(3) : '.' not defined diff --git a/test/asm/utf-8.out.pipe b/test/asm/utf-8.out.pipe new file mode 100644 index 00000000..e69de29b