diff options
author | ymherklotz <ymherklotz@gmail.com> | 2017-03-10 20:24:02 +0000 |
---|---|---|
committer | ymherklotz <ymherklotz@gmail.com> | 2017-03-10 20:24:02 +0000 |
commit | 545ce63f17eed12c193690868ce6344e7a497c91 (patch) | |
tree | d325b9504aade9487c8d982a5e3600ac43b8be2c | |
parent | a6fa6da5de8252a205e000dd7acc2589735aa55c (diff) | |
download | Compiler-545ce63f17eed12c193690868ce6344e7a497c91.tar.gz Compiler-545ce63f17eed12c193690868ce6344e7a497c91.zip |
Adding test cases
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | c_compiler/test/in/ComplexAssignment.c | 20 | ||||
-rw-r--r-- | c_compiler/test/in/ScopeWithAdd.c | 11 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleAdd.c | 5 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleAdd_2.c | 9 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleAssignment.c | 5 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleDeclaration.c | 4 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleReturn.c | 3 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleScope.c | 7 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleShadowing.c | 8 | ||||
-rw-r--r-- | c_compiler/test/in/SimpleSubtraction.c | 6 |
11 files changed, 78 insertions, 1 deletions
@@ -11,6 +11,5 @@ c_compiler/build/ .#* *.log .vagrant -test/ *~ working/ diff --git a/c_compiler/test/in/ComplexAssignment.c b/c_compiler/test/in/ComplexAssignment.c new file mode 100644 index 0000000..394cedb --- /dev/null +++ b/c_compiler/test/in/ComplexAssignment.c @@ -0,0 +1,20 @@ +int main() +{ + int a = 5; + int b = 49; + int c = 239; + int d = 23; + int f = 234; + int g = 12; + + a = d; + b = f; + g = f; + a = g; + d = g; + a = d; + g = c; + c = a; + a = f; + return a; +} diff --git a/c_compiler/test/in/ScopeWithAdd.c b/c_compiler/test/in/ScopeWithAdd.c new file mode 100644 index 0000000..5505cbf --- /dev/null +++ b/c_compiler/test/in/ScopeWithAdd.c @@ -0,0 +1,11 @@ +int main() { + int x = 4; + int y = 35; + + { + int x = 3 + 3; + } + + x = 4 + 5; + return x; +} diff --git a/c_compiler/test/in/SimpleAdd.c b/c_compiler/test/in/SimpleAdd.c new file mode 100644 index 0000000..a04941d --- /dev/null +++ b/c_compiler/test/in/SimpleAdd.c @@ -0,0 +1,5 @@ +int main() { + int a = 68; + int b = 38; + return a + b; +} diff --git a/c_compiler/test/in/SimpleAdd_2.c b/c_compiler/test/in/SimpleAdd_2.c new file mode 100644 index 0000000..c03a527 --- /dev/null +++ b/c_compiler/test/in/SimpleAdd_2.c @@ -0,0 +1,9 @@ +int main() { + int x = 4; + int y; + x = x + 1; + x = x + 2; + + y = x - 1; + y = x + y; +} diff --git a/c_compiler/test/in/SimpleAssignment.c b/c_compiler/test/in/SimpleAssignment.c new file mode 100644 index 0000000..911f7e2 --- /dev/null +++ b/c_compiler/test/in/SimpleAssignment.c @@ -0,0 +1,5 @@ +int main() { + int x; + x = 15; + return x; +} diff --git a/c_compiler/test/in/SimpleDeclaration.c b/c_compiler/test/in/SimpleDeclaration.c new file mode 100644 index 0000000..95c954c --- /dev/null +++ b/c_compiler/test/in/SimpleDeclaration.c @@ -0,0 +1,4 @@ +int main() { + int x = 26; + return x; +} diff --git a/c_compiler/test/in/SimpleReturn.c b/c_compiler/test/in/SimpleReturn.c new file mode 100644 index 0000000..c362948 --- /dev/null +++ b/c_compiler/test/in/SimpleReturn.c @@ -0,0 +1,3 @@ +int main() { + return 13; +} diff --git a/c_compiler/test/in/SimpleScope.c b/c_compiler/test/in/SimpleScope.c new file mode 100644 index 0000000..85294a1 --- /dev/null +++ b/c_compiler/test/in/SimpleScope.c @@ -0,0 +1,7 @@ +int main() { + int x = 23; + { + x = 123; + } + return x; +} diff --git a/c_compiler/test/in/SimpleShadowing.c b/c_compiler/test/in/SimpleShadowing.c new file mode 100644 index 0000000..927afce --- /dev/null +++ b/c_compiler/test/in/SimpleShadowing.c @@ -0,0 +1,8 @@ +int main() { + int x = 12; + { + int x = 39; + } + + return x; +} diff --git a/c_compiler/test/in/SimpleSubtraction.c b/c_compiler/test/in/SimpleSubtraction.c new file mode 100644 index 0000000..4d88002 --- /dev/null +++ b/c_compiler/test/in/SimpleSubtraction.c @@ -0,0 +1,6 @@ +int main() { + int a = 23; + int b = 19; + int c = a - b; + return c; +} |