Skip to content
Snippets Groups Projects
Commit bb0708d4 authored by Wilke Pierre's avatar Wilke Pierre
Browse files

fix tests

parent b958071a
No related branches found
No related tags found
No related merge requests found
Showing
with 364 additions and 28 deletions
struct S {
int t[4];
};
int main(){
struct S s;
(s.t)[0] = 1;
print_int((s.t)[0]);
return (s.t)[0];
}
{"output": "1", "error": null, "retval": 1}
\ No newline at end of file
{"output": "1", "error": null, "retval": 1}
\ No newline at end of file
SYM_STRUCT
SYM_IDENTIFIER(S)
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(4)
SYM_RBRACKET
SYM_SEMICOLON
SYM_RBRACE
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_STRUCT
SYM_IDENTIFIER(S)
SYM_IDENTIFIER(s)
SYM_SEMICOLON
SYM_LPARENTHESIS
SYM_IDENTIFIER(s)
SYM_POINT
SYM_IDENTIFIER(t)
SYM_RPARENTHESIS
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_ASSIGN
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_IDENTIFIER(print_int)
SYM_LPARENTHESIS
SYM_LPARENTHESIS
SYM_IDENTIFIER(s)
SYM_POINT
SYM_IDENTIFIER(t)
SYM_RPARENTHESIS
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_SEMICOLON
SYM_RETURN
SYM_LPARENTHESIS
SYM_IDENTIFIER(s)
SYM_POINT
SYM_IDENTIFIER(t)
SYM_RPARENTHESIS
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
int main(int argc,char* argv[]){
int t[10];
t[0] = 5;
t[1] = 12;
partition(t,0,1,0);
print(t[0]);
print(t[0]);
print(t[1]);
return 0;
}
int swap(int* t,int i,int j){
int tmp = t[i];
t[i] = t[j];
t[j] = tmp;
return 0;
}
int partition(int* t, int begin, int end, int pivot){
swap(t, pivot, end);
int j = begin;
int i = begin;
while(i <= end - 1){
if(t[i] <= t[end]){
swap(t, i, j);
j = j + 1;
} else {
}
i = i + 1;
}
swap(t, end, j);
return j;
int main(){
int t[10];
t[0] = 5;
t[1] = 12;
swap(t,0,1);
print(t[0]);
print(t[1]);
return 0;
}
{"output": "12\n5\n", "error": null, "retval": 0}
\ No newline at end of file
{"output": "12\n5\n", "error": null, "retval": 0}
\ No newline at end of file
SYM_INT
SYM_IDENTIFIER(swap)
SYM_LPARENTHESIS
SYM_INT
SYM_ASTERISK
SYM_IDENTIFIER(t)
SYM_COMMA
SYM_INT
SYM_IDENTIFIER(i)
SYM_COMMA
SYM_INT
SYM_IDENTIFIER(j)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(tmp)
SYM_ASSIGN
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_SEMICOLON
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_ASSIGN
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_IDENTIFIER(j)
SYM_RBRACKET
SYM_SEMICOLON
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_IDENTIFIER(j)
SYM_RBRACKET
SYM_ASSIGN
SYM_IDENTIFIER(tmp)
SYM_SEMICOLON
SYM_RETURN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_RBRACE
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(10)
SYM_RBRACKET
SYM_SEMICOLON
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_ASSIGN
SYM_INTEGER(5)
SYM_SEMICOLON
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_ASSIGN
SYM_INTEGER(12)
SYM_SEMICOLON
SYM_IDENTIFIER(swap)
SYM_LPARENTHESIS
SYM_IDENTIFIER(t)
SYM_COMMA
SYM_INTEGER(0)
SYM_COMMA
SYM_INTEGER(1)
SYM_RPARENTHESIS
SYM_SEMICOLON
SYM_IDENTIFIER(print)
SYM_LPARENTHESIS
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_SEMICOLON
SYM_IDENTIFIER(print)
SYM_LPARENTHESIS
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_SEMICOLON
SYM_RETURN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
int i = 37;
int main(int argc, char** argv){
int main(){
return i;
}
{"output": "", "error": null, "retval": 37}
\ No newline at end of file
{"output": "", "error": null, "retval": 37}
\ No newline at end of file
SYM_INT
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_INTEGER(37)
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_RETURN
SYM_IDENTIFIER(i)
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
......@@ -2,7 +2,7 @@
int max = 20;
int objs[20];
int main(int argc, char** argv){
int main(){
int i = 0;
int sum = 0;
while (i < max){
......
{"output": "0\n0\n1\n3\n6\n10\n15\n21\n28\n36\n45\n55\n66\n78\n91\n105\n120\n136\n153\n171\n", "error": null, "retval": 171}
\ No newline at end of file
{"output": "0\n0\n1\n3\n6\n10\n15\n21\n28\n36\n45\n55\n66\n78\n91\n105\n120\n136\n153\n171\n", "error": null, "retval": 171}
\ No newline at end of file
SYM_INT
SYM_IDENTIFIER(max)
SYM_ASSIGN
SYM_INTEGER(20)
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_INTEGER(20)
SYM_RBRACKET
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(sum)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_WHILE
SYM_LPARENTHESIS
SYM_IDENTIFIER(i)
SYM_LT
SYM_IDENTIFIER(max)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_ASSIGN
SYM_IDENTIFIER(sum)
SYM_SEMICOLON
SYM_IDENTIFIER(sum)
SYM_ASSIGN
SYM_IDENTIFIER(sum)
SYM_PLUS
SYM_IDENTIFIER(i)
SYM_SEMICOLON
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_PLUS
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_RBRACE
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_WHILE
SYM_LPARENTHESIS
SYM_IDENTIFIER(i)
SYM_LT
SYM_IDENTIFIER(max)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_IDENTIFIER(print)
SYM_LPARENTHESIS
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_SEMICOLON
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_PLUS
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_RBRACE
SYM_RETURN
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_IDENTIFIER(max)
SYM_MINUS
SYM_INTEGER(1)
SYM_RBRACKET
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
......@@ -6,7 +6,7 @@ struct my_struct {
struct my_struct objs[2];
int main(int argc, char** argv){
int main(){
int i = 0;
while (i < 2){
(objs[i]).x = i;
......
{"output": "", "error": null, "retval": 1}
\ No newline at end of file
{"output": "", "error": null, "retval": 1}
\ No newline at end of file
SYM_STRUCT
SYM_IDENTIFIER(my_struct)
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(x)
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(y)
SYM_SEMICOLON
SYM_RBRACE
SYM_SEMICOLON
SYM_STRUCT
SYM_IDENTIFIER(my_struct)
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_INTEGER(2)
SYM_RBRACKET
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_WHILE
SYM_LPARENTHESIS
SYM_IDENTIFIER(i)
SYM_LT
SYM_INTEGER(2)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_LPARENTHESIS
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_POINT
SYM_IDENTIFIER(x)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_SEMICOLON
SYM_LPARENTHESIS
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_POINT
SYM_IDENTIFIER(y)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_SEMICOLON
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_PLUS
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_RBRACE
SYM_RETURN
SYM_LPARENTHESIS
SYM_IDENTIFIER(objs)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_RPARENTHESIS
SYM_POINT
SYM_IDENTIFIER(x)
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment