From 08fabe9627d89b9811b0fafe1c2bb11773d02bbc Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 4 Jul 2020 03:16:10 -0400 Subject: Tests + Add initial tests ~ Some tests fail. These bugs will warrent a section in the readme. --- tests/block-test.tnsl | 15 +++++++++++++++ tests/comment-test.tnsl | 22 ++++++++++++++++++++++ tests/literal-test.tnsl | 10 ++++++++++ tests/run-tests.sh | 13 +++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 tests/block-test.tnsl create mode 100644 tests/comment-test.tnsl create mode 100644 tests/literal-test.tnsl create mode 100755 tests/run-tests.sh diff --git a/tests/block-test.tnsl b/tests/block-test.tnsl new file mode 100644 index 0000000..14663f3 --- /dev/null +++ b/tests/block-test.tnsl @@ -0,0 +1,15 @@ +;int i = 0 + +/;if (i==0) + ;i = 2 +;//;else + ;i = 0 +;/ + +# ;; can be used as a quick block re-definition + +/;if (i==0) + ;i = 2 +;;else + ;i = 0 +;/ \ No newline at end of file diff --git a/tests/comment-test.tnsl b/tests/comment-test.tnsl new file mode 100644 index 0000000..fe07b45 --- /dev/null +++ b/tests/comment-test.tnsl @@ -0,0 +1,22 @@ +;/# +#/; + +a/# +#/a + +/;/# +#/;/ + +/# + Ok, so this should give no output either +#/ + +#; +#a +# /; + +;# +a# +/;# +#;/ +;/ \ No newline at end of file diff --git a/tests/literal-test.tnsl b/tests/literal-test.tnsl new file mode 100644 index 0000000..a7fd81e --- /dev/null +++ b/tests/literal-test.tnsl @@ -0,0 +1,10 @@ +;string s = "\"" +;string st="\\" + +;int i = 0 +;int j=1 + +;float f = .2 +;float d=3.1415 + +;char c = '\'';char ch='\uxxxx' diff --git a/tests/run-tests.sh b/tests/run-tests.sh new file mode 100755 index 0000000..4b8d0b1 --- /dev/null +++ b/tests/run-tests.sh @@ -0,0 +1,13 @@ +PARSECMD=../build/parse +PARSEFILE=" " + +parse () { + $PARSECMD -in $PARSEFILE.tnsl -out $PARSEFILE.tnp +} + +PARSEFILE=block-test +parse +PARSEFILE=comment-test +parse +PARSEFILE=literal-test +parse \ No newline at end of file -- cgit v1.2.3