summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/block-test.tnsl15
-rw-r--r--tests/comment-test.tnsl22
-rw-r--r--tests/literal-test.tnsl10
-rwxr-xr-xtests/run-tests.sh13
4 files changed, 60 insertions, 0 deletions
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