-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
open Assert | ||
open Gradedtests | ||
|
||
let prefix = Test_config.global_prefix ^ "./compiler-design-eth-tests/05/thbwd/" | ||
|
||
let tests = ( | ||
executed_oat_file [ | ||
(prefix ^ "compile_struct_order.oat", "", "123412340"); | ||
(prefix ^ "polymorphic_array.oat", "", "1230"); | ||
] @ | ||
typecheck_file_error [ | ||
prefix ^ "dead_code1.oat"; | ||
prefix ^ "dead_code2.oat"; | ||
prefix ^ "illegal_for_stmt.oat"; | ||
prefix ^ "assign_global_function.oat"; | ||
prefix ^ "array_init_shadowing.oat"; | ||
] @ | ||
typecheck_file_correct [ | ||
prefix ^ "undead_code1.oat"; | ||
prefix ^ "undead_code2.oat"; | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
int program(int argc, string[] argv) { | ||
var j = 43; | ||
var y = new int[3]{j->0}; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
int x() { | ||
return 4; | ||
} | ||
|
||
int y() { | ||
return 2; | ||
} | ||
|
||
int program(int argc, string[] argv) { | ||
x = y; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
struct Test { | ||
int x; | ||
int y; | ||
int a; | ||
int z | ||
} | ||
|
||
global gt = new Test {y=2; x=1; z=4; a=3}; | ||
|
||
int program(int argc, string[] argv) { | ||
var t = new Test {z=4; y=2; a=3; x=1}; | ||
print_int(gt.x); | ||
print_int(gt.y); | ||
print_int(gt.a); | ||
print_int(gt.z); | ||
print_int(t.x); | ||
print_int(t.y); | ||
print_int(t.a); | ||
print_int(t.z); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
int program(int argc, string[] argv) { | ||
return 0; | ||
print_string("I'm a zombie"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
int program(int argc, string[] argv) { | ||
if (332 < 43) { | ||
return 4; | ||
} else { | ||
return 43; | ||
} | ||
print_string("I'm a zombie"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int program(int argc, string[] argv) { | ||
for (var i = 0; i < 40; return 3;) { | ||
print_string("I'm a zombie"); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
struct A { int x } | ||
struct B { int x ; int y } | ||
struct C { int x ; int y ; int z } | ||
|
||
int program(int argc, string[] argv) { | ||
var y = new A[]{new A{x=1}, new B{x=2; y=54}, new C{x=3; y=511; z=432}}; | ||
for (var i = 0; i < 3; i = i + 1;) { | ||
print_int(y[i].x); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
int program(int argc, string[] argv) { | ||
while (true) { | ||
return 0; | ||
} | ||
print_string("I'm a zombie"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
int program(int argc, string[] argv) { | ||
for (var i = 0; i < 10; i = i + 1;) { | ||
return 0; | ||
} | ||
print_string("I'm a zombie"); | ||
return 0; | ||
} |