From 28acfb34870130e09bfde6f7377bb698f13d26cc Mon Sep 17 00:00:00 2001 From: Martin Kobelka Date: Wed, 22 Nov 2017 19:05:28 +0100 Subject: [PATCH] Add some expression tests --- ifj2017/tests/04_expressions/25.code | 5 +++++ ifj2017/tests/04_expressions/25.stdout | 1 + ifj2017/tests/04_expressions/26.code | 6 ++++++ ifj2017/tests/04_expressions/26.stdout | 1 + ifj2017/tests/04_expressions/27.code | 4 ++++ ifj2017/tests/04_expressions/28.code | 4 ++++ ifj2017/tests/04_expressions/29.code | 4 ++++ ifj2017/tests/04_expressions/29.stdout | 1 + ifj2017/tests/04_expressions/30.code | 4 ++++ ifj2017/tests/04_expressions/tests.json | 20 ++++++++++++++++++++ 10 files changed, 50 insertions(+) create mode 100644 ifj2017/tests/04_expressions/25.code create mode 100644 ifj2017/tests/04_expressions/25.stdout create mode 100644 ifj2017/tests/04_expressions/26.code create mode 100644 ifj2017/tests/04_expressions/26.stdout create mode 100644 ifj2017/tests/04_expressions/27.code create mode 100644 ifj2017/tests/04_expressions/28.code create mode 100644 ifj2017/tests/04_expressions/29.code create mode 100644 ifj2017/tests/04_expressions/29.stdout create mode 100644 ifj2017/tests/04_expressions/30.code diff --git a/ifj2017/tests/04_expressions/25.code b/ifj2017/tests/04_expressions/25.code new file mode 100644 index 0000000..77f9a80 --- /dev/null +++ b/ifj2017/tests/04_expressions/25.code @@ -0,0 +1,5 @@ +' Many brackets +scope +dim a as integer = 10 +print (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((a))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); +end scope \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/25.stdout b/ifj2017/tests/04_expressions/25.stdout new file mode 100644 index 0000000..3d1a563 --- /dev/null +++ b/ifj2017/tests/04_expressions/25.stdout @@ -0,0 +1 @@ + 10 \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/26.code b/ifj2017/tests/04_expressions/26.code new file mode 100644 index 0000000..1687f84 --- /dev/null +++ b/ifj2017/tests/04_expressions/26.code @@ -0,0 +1,6 @@ +' Too Many brackets +scope +dim a as integer = 10 +dim b as integer = 40 +print (((((((((((((((((((((((((((((((a))))))))))))))))*(((((((((((((((((((((((((((((((b)*a)))))))))))))))))*(((((((((((((((((((((((((((((((b)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))*(((((((((((((((((((((((((((((((a))))))))))))))))))))))))))))))); +end scope \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/26.stdout b/ifj2017/tests/04_expressions/26.stdout new file mode 100644 index 0000000..e36aae9 --- /dev/null +++ b/ifj2017/tests/04_expressions/26.stdout @@ -0,0 +1 @@ + 1600000 \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/27.code b/ifj2017/tests/04_expressions/27.code new file mode 100644 index 0000000..becb745 --- /dev/null +++ b/ifj2017/tests/04_expressions/27.code @@ -0,0 +1,4 @@ +' Divide priority (fail types) +scope + print 100000\3/4\4\4/6; +end scope \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/28.code b/ifj2017/tests/04_expressions/28.code new file mode 100644 index 0000000..35364c7 --- /dev/null +++ b/ifj2017/tests/04_expressions/28.code @@ -0,0 +1,4 @@ +' Divide priority 2 (fail types) +scope + print 10000000/3\4/4 +end scope diff --git a/ifj2017/tests/04_expressions/29.code b/ifj2017/tests/04_expressions/29.code new file mode 100644 index 0000000..4e38843 --- /dev/null +++ b/ifj2017/tests/04_expressions/29.code @@ -0,0 +1,4 @@ +' Bracket, \ and / +scope + print (7\4)/2; +end scope \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/29.stdout b/ifj2017/tests/04_expressions/29.stdout new file mode 100644 index 0000000..c988892 --- /dev/null +++ b/ifj2017/tests/04_expressions/29.stdout @@ -0,0 +1 @@ + 0.5 \ No newline at end of file diff --git a/ifj2017/tests/04_expressions/30.code b/ifj2017/tests/04_expressions/30.code new file mode 100644 index 0000000..6a556f3 --- /dev/null +++ b/ifj2017/tests/04_expressions/30.code @@ -0,0 +1,4 @@ +' Divide priority 2 (fail types) +scope + print 7\4/2 +end scope diff --git a/ifj2017/tests/04_expressions/tests.json b/ifj2017/tests/04_expressions/tests.json index cdb86c1..585733d 100644 --- a/ifj2017/tests/04_expressions/tests.json +++ b/ifj2017/tests/04_expressions/tests.json @@ -40,6 +40,26 @@ "info": "Print boolean expr 2", "stdout": "false", "code": "scope \n print 2 > 2.3;\n end scope" + }, + { + "name": "24", + "timeout": 1 + }, + { + "name": "25", + "timeout": 1 + }, + { + "name": "27", + "compiler_exit_code": 4 + }, + { + "name": "28", + "compiler_exit_code": 4 + }, + { + "name": "30", + "compiler_exit_code": 4 } ] } \ No newline at end of file