Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkobelka committed Nov 22, 2017
1 parent 35f0b2f commit bdc333d
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ifj2017/tests/11_base/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@
{
"stdout": "true",
"name": "11"
},
{
"info": "Empty binary number",
"code": "scope \n dim a as integer = &b\n print a;\n end scope ",
"stdout": " 0"
},
{
"info": "Empty octa number",
"code": "scope \n dim a as integer = &o\n print a;\n end scope ",
"stdout": " 0"
},
{
"info": "Empty hexa number",
"code": "scope \n dim a as integer = &h\n print a;\n end scope ",
"stdout": " 0"
},
{
"info": "Print empty binary number",
"code": "scope \n print &b;\n end scope ",
"stdout": " 0"
}
],
"extensions": [
Expand Down
70 changes: 70 additions & 0 deletions ifj2017/tests/66_errors/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,36 @@
"compiler_exit_code": 3,
"code": "scope \n dim a as integer \n input ab \n end scope"
},
{
"info": "Undefined variable assignment",
"compiler_exit_code": 3,
"code": "scope \n a = 31 \n end scope"
},
{
"info": "Undefined variable assignment in function",
"compiler_exit_code": 3,
"code": "function foo() as integer \n dim a as integer\n ab = 10 \n end function \n scope \n end scope"
},
{
"info": "Undefined variable assignment in function",
"compiler_exit_code": 3,
"code": "function foo() as integer \n dim a as integer\n ab = 10 \n end function \n scope \n end scope"
},
{
"info": "Undefined variable in if",
"compiler_exit_code": 3,
"code": "scope \n if a < 10 then \n else \n end if \n end scope"
},
{
"info": "Undefined variable in while",
"compiler_exit_code": 3,
"code": "scope \n do while a < 10 then \n loop \n end scope"
},
{
"info": "Undefined variable in calling function",
"compiler_exit_code": 3,
"code": "function foo(a as integer) as integer \n end function \n scope \n dim a as integer \n a = foo(b) \n end scope"
},
{
"info": "No eol after statement",
"compiler_exit_code": 2,
Expand All @@ -333,6 +363,36 @@
"compiler_exit_code": 2,
"code": "scope \n end scope \n declare function foo() as integer"
},
{
"info": "function in function",
"compiler_exit_code": 2,
"code": "function foo() as integer \n function bar() as integer \n end function \n end function \n scope \n end scope \n"
},
{
"info": "declaration in function",
"compiler_exit_code": 2,
"code": "function foo() as integer \n declare function bar() as integer \n end function \n scope \n end scope \n"
},
{
"info": "Function in scope",
"compiler_exit_code": 2,
"code": " scope \n function foo() as integer \n end function \n end scope \n"
},
{
"info": "Declaration in scope",
"compiler_exit_code": 2,
"code": " scope \n declare function foo() as integer \n end scope \n"
},
{
"info": "Declaration in function in scope",
"compiler_exit_code": 2,
"code": " scope \n function foo() as integer \n declare function foo() as integer \n end function \n end scope \n"
},
{
"info": "Scope in function",
"compiler_exit_code": 2,
"code": "function foo() as integer \n scope \n end scope \n end function \n scope \n end scope"
},
{
"info": "No end scope",
"compiler_exit_code": 2,
Expand All @@ -358,6 +418,16 @@
"compiler_exit_code": 2,
"code": "scope \n print 10 10;\n end scope"
},
{
"info": "Lexical error in assignment",
"compiler_exit_code": 1,
"code": "scope \n dim a as integer = &\n end scope"
},
{
"info": "Lexical error in print",
"compiler_exit_code": 1,
"code": "scope \n print &;\n end scope"
},
{
"name": "19",
"compiler_exit_code": 3
Expand Down

0 comments on commit bdc333d

Please sign in to comment.