8000 Added test cases - code · cybex-dev/Robot-Compiler@c75cb18 · GitHub
[go: up one dir, main page]

Skip 8000 to content

Commit c75cb18

Browse files
committed
Added test cases - code
1 parent e11d5a0 commit c75cb18

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

main.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,29 @@ int main() {
2727
#ifndef _TESTING
2828
std::getline(std::cin, code);
2929
#else
30-
code = "let var t: int in t := t + 1";
31-
// code = "if(true*true) then x:=x+1 else z:=z+2";
30+
// syntax issue - missing in keyword
31+
// code = "let var t: int t := t + t";
32+
33+
// test string <-> int incompatibility
34+
// code = "let var t: int in t := t + abc";
35+
36+
// test int <-> int incompatibility, assignment, let command
37+
// code = "let var t: int in t := t + 111";
38+
39+
// shows breaking of language example if statement requires Commands (i.e. assiignemnt, ifstatement or let)
40+
// code = "if(true+true) then x+x else z+z";
41+
42+
// shows nested commands
43+
// code = "if(true+true) then let var e: int in e:=e+1 else let var z: int in z:=z+2";
44+
45+
// shows nested let commands with duplicate variables
46+
// code = "let var e: int in let var e: int in e:=e+e";
47+
48+
// shows incompatible data types
49+
// code = "if(true+true) then x:=x+1 else z:=z+2";
50+
51+
// shows undeclared variable
52+
// code = "if(true+true) then x:=z+z else z:=z+2";
3253
#endif
3354
}
3455

0 commit comments

Comments
 (0)
0