From 7e377e2a32562166a11fc28aaf1ebd02ca5d966e Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Wed, 17 Jul 2013 22:25:48 +0200 Subject: [PATCH] adding test system --- test.sh | 17 +++++++++++++++++ tests/binarynumber.in | 1 + tests/binarynumber.out | 1 + tests/number.in | 1 + tests/number.out | 1 + tests/string-2.in | 1 + tests/string-2.out | 1 + tests/string-3.in | 1 + tests/string-3.out | 1 + tests/string.in | 1 + tests/string.out | 1 + 11 files changed, 27 insertions(+) create mode 100755 test.sh create mode 100644 tests/binarynumber.in create mode 100644 tests/binarynumber.out create mode 100644 tests/number.in create mode 100644 tests/number.out create mode 100644 tests/string-2.in create mode 100644 tests/string-2.out create mode 100644 tests/string-3.in create mode 100644 tests/string-3.out create mode 100644 tests/string.in create mode 100644 tests/string.out diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..4b3fa0e --- /dev/null +++ b/test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env zsh + +for fic in tests/*.in; do + input="${fic:r}" + arg="$(cat $input.in)" + print -n -- "$input: " + runghc y.hs "$arg" > $input.res + if diff $input.res $input.out > /dev/null; then + print -- "OK" + else + print -- "ERROR" + print -- " expected: '$(cat $input.out)'" + print -- " got: '$(cat $input.res)'" + print -- "" + fi + \rm -f $input.res +done diff --git a/tests/binarynumber.in b/tests/binarynumber.in new file mode 100644 index 0000000..a3b9bf9 --- /dev/null +++ b/tests/binarynumber.in @@ -0,0 +1 @@ +#b001010 diff --git a/tests/binarynumber.out b/tests/binarynumber.out new file mode 100644 index 0000000..9f500df --- /dev/null +++ b/tests/binarynumber.out @@ -0,0 +1 @@ +Number 10 diff --git a/tests/number.in b/tests/number.in new file mode 100644 index 0000000..f5c8955 --- /dev/null +++ b/tests/number.in @@ -0,0 +1 @@ +32 diff --git a/tests/number.out b/tests/number.out new file mode 100644 index 0000000..64ed153 --- /dev/null +++ b/tests/number.out @@ -0,0 +1 @@ +Number 32 diff --git a/tests/string-2.in b/tests/string-2.in new file mode 100644 index 0000000..8d0a559 --- /dev/null +++ b/tests/string-2.in @@ -0,0 +1 @@ +"This is a string with a return ->\n<- Here" diff --git a/tests/string-2.out b/tests/string-2.out new file mode 100644 index 0000000..5a16424 --- /dev/null +++ b/tests/string-2.out @@ -0,0 +1 @@ +String "This is a string with a return ->\n<- Here" diff --git a/tests/string-3.in b/tests/string-3.in new file mode 100644 index 0000000..253907b --- /dev/null +++ b/tests/string-3.in @@ -0,0 +1 @@ +"This is a string with a tab ->\t<- Here" diff --git a/tests/string-3.out b/tests/string-3.out new file mode 100644 index 0000000..0c90516 --- /dev/null +++ b/tests/string-3.out @@ -0,0 +1 @@ +String "This is a string with a tab ->\t<- Here" diff --git a/tests/string.in b/tests/string.in new file mode 100644 index 0000000..4c0cf18 --- /dev/null +++ b/tests/string.in @@ -0,0 +1 @@ +"This is a simple string" diff --git a/tests/string.out b/tests/string.out new file mode 100644 index 0000000..1513617 --- /dev/null +++ b/tests/string.out @@ -0,0 +1 @@ +String "This is a simple string"