diff --git a/tests/ptr/ptr.e b/tests/ptr/ptr.e new file mode 100644 index 0000000000000000000000000000000000000000..d998f2871a0b2a67b2a233db00b3b90714ac72f1 --- /dev/null +++ b/tests/ptr/ptr.e @@ -0,0 +1,8 @@ +void f(int* z, int x, int y){ + *z = x + y; +} +int main(int x, int y){ + int z = 3; + f(&z, x, y); + return z; +} diff --git a/tests/ptr/ptr.e.expect_14_12_3_8_12 b/tests/ptr/ptr.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..91317f7cd220f36d0146c3982acb44967db89411 --- /dev/null +++ b/tests/ptr/ptr.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 26} \ No newline at end of file diff --git a/tests/ptr/ptr.e.expect_1_2_3 b/tests/ptr/ptr.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/ptr/ptr.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 3} \ No newline at end of file diff --git a/tests/ptr/ptr.e.expect_lexer b/tests/ptr/ptr.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..dc2a41e1acd3bd5b76610234d3fd8e1f6f0075de --- /dev/null +++ b/tests/ptr/ptr.e.expect_lexer @@ -0,0 +1,52 @@ +SYM_VOID +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_ASTERISK +SYM_IDENTIFIER(z) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_ASTERISK +SYM_IDENTIFIER(z) +SYM_ASSIGN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(z) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_AMPERSAND +SYM_IDENTIFIER(z) +SYM_COMMA +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(z) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/ptr/ptr2.e b/tests/ptr/ptr2.e new file mode 100644 index 0000000000000000000000000000000000000000..dd2921eb38b3045cc67a0843803083e3235fa224 --- /dev/null +++ b/tests/ptr/ptr2.e @@ -0,0 +1,7 @@ +int main(){ + int x = 0; + int *y = &x; + int** z = &y; + **z = 3; + return x; +} diff --git a/tests/ptr/ptr2.e.expect_14_12_3_8_12 b/tests/ptr/ptr2.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/ptr/ptr2.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 3} \ No newline at end of file diff --git a/tests/ptr/ptr2.e.expect_1_2_3 b/tests/ptr/ptr2.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/ptr/ptr2.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 3} \ No newline at end of file diff --git a/tests/ptr/ptr2.e.expect_lexer b/tests/ptr/ptr2.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..a68606b7e6ff2661e6d94161bd83fd92ef74d545 --- /dev/null +++ b/tests/ptr/ptr2.e.expect_lexer @@ -0,0 +1,36 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_INT +SYM_ASTERISK +SYM_IDENTIFIER(y) +SYM_ASSIGN +SYM_AMPERSAND +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_INT +SYM_ASTERISK +SYM_ASTERISK +SYM_IDENTIFIER(z) +SYM_ASSIGN +SYM_AMPERSAND +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_ASTERISK +SYM_ASTERISK +SYM_IDENTIFIER(z) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF