aboutsummaryrefslogtreecommitdiffstats
path: root/c_parser/test
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-02-19 05:06:45 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-02-19 05:06:45 +0000
commit0e9e8dab385375c0cbb83d89a71fbf8d71206b47 (patch)
treebacb57c4e93652ac8348d7951c63f1796c9f7750 /c_parser/test
parent258c14392606ec4ba0a590cac80ba4198ef920d9 (diff)
downloadCompiler-0e9e8dab385375c0cbb83d89a71fbf8d71206b47.tar.gz
Compiler-0e9e8dab385375c0cbb83d89a71fbf8d71206b47.zip
Finished if statement for the most part
Diffstat (limited to 'c_parser/test')
-rw-r--r--c_parser/test/in/07.c6
-rw-r--r--c_parser/test/in/08.c10
-rw-r--r--c_parser/test/in/09.c15
-rw-r--r--c_parser/test/out/07.diff.txt7
-rw-r--r--c_parser/test/out/07.stderr.txt1
-rw-r--r--c_parser/test/out/07.stdout.xml11
-rw-r--r--c_parser/test/out/08.diff.txt0
-rw-r--r--c_parser/test/out/08.stderr.txt0
-rw-r--r--c_parser/test/out/08.stdout.xml16
-rw-r--r--c_parser/test/out/09.diff.txt0
-rw-r--r--c_parser/test/out/09.stderr.txt0
-rw-r--r--c_parser/test/out/09.stdout.xml21
-rw-r--r--c_parser/test/ref/07.stdout.xml5
-rw-r--r--c_parser/test/ref/08.stdout.xml16
-rw-r--r--c_parser/test/ref/09.stdout.xml21
15 files changed, 119 insertions, 10 deletions
diff --git a/c_parser/test/in/07.c b/c_parser/test/in/07.c
index baa3ba5..6abb5b5 100644
--- a/c_parser/test/in/07.c
+++ b/c_parser/test/in/07.c
@@ -1,3 +1,5 @@
-if(x == y) {
- int z;
+int foo(int a) {
+ if(x == y) {
+ int z;
+ }
}
diff --git a/c_parser/test/in/08.c b/c_parser/test/in/08.c
new file mode 100644
index 0000000..3d8e983
--- /dev/null
+++ b/c_parser/test/in/08.c
@@ -0,0 +1,10 @@
+int func(int a, int b) {
+ int c = 0;
+ if(a == b) {
+ int d;
+ } else if(a == d) {
+ int e;
+ return d;
+ }
+ return c;
+}
diff --git a/c_parser/test/in/09.c b/c_parser/test/in/09.c
new file mode 100644
index 0000000..08a7ee4
--- /dev/null
+++ b/c_parser/test/in/09.c
@@ -0,0 +1,15 @@
+int x()
+{}
+
+int g;
+
+int zz(int a, int b, int c)
+{
+ if(a==b){
+ int a;
+ return a;
+ }else{
+ int fsdfsdfs;
+ return c;
+ }
+}
diff --git a/c_parser/test/out/07.diff.txt b/c_parser/test/out/07.diff.txt
index 292a596..e69de29 100644
--- a/c_parser/test/out/07.diff.txt
+++ b/c_parser/test/out/07.diff.txt
@@ -1,7 +0,0 @@
-1,6d0
-< <?xml version="1.0"?>
-< <Program>
-< <Scope>
-< <Variable id="z" />
-< </Scope>
-< </Program>
diff --git a/c_parser/test/out/07.stderr.txt b/c_parser/test/out/07.stderr.txt
index 6200509..e69de29 100644
--- a/c_parser/test/out/07.stderr.txt
+++ b/c_parser/test/out/07.stderr.txt
@@ -1 +0,0 @@
-Parse error : syntax error
diff --git a/c_parser/test/out/07.stdout.xml b/c_parser/test/out/07.stdout.xml
index e69de29..ff0efb2 100644
--- a/c_parser/test/out/07.stdout.xml
+++ b/c_parser/test/out/07.stdout.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<Program>
+<Function id="foo">
+<Parameter id="a" />
+<Scope>
+<Scope>
+<Variable id="z" />
+</Scope>
+</Scope>
+</Function>
+</Program>
diff --git a/c_parser/test/out/08.diff.txt b/c_parser/test/out/08.diff.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/c_parser/test/out/08.diff.txt
diff --git a/c_parser/test/out/08.stderr.txt b/c_parser/test/out/08.stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/c_parser/test/out/08.stderr.txt
diff --git a/c_parser/test/out/08.stdout.xml b/c_parser/test/out/08.stdout.xml
new file mode 100644
index 0000000..7929e75
--- /dev/null
+++ b/c_parser/test/out/08.stdout.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<Program>
+<Function id="func">
+<Parameter id="a" />
+<Parameter id="b" />
+<Scope>
+<Variable id="c" />
+<Scope>
+<Variable id="d" />
+</Scope>
+<Scope>
+<Variable id="e" />
+</Scope>
+</Scope>
+</Function>
+</Program>
diff --git a/c_parser/test/out/09.diff.txt b/c_parser/test/out/09.diff.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/c_parser/test/out/09.diff.txt
diff --git a/c_parser/test/out/09.stderr.txt b/c_parser/test/out/09.stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/c_parser/test/out/09.stderr.txt
diff --git a/c_parser/test/out/09.stdout.xml b/c_parser/test/out/09.stdout.xml
new file mode 100644
index 0000000..7a7a770
--- /dev/null
+++ b/c_parser/test/out/09.stdout.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<Program>
+<Function id="x">
+<Scope>
+</Scope>
+</Function>
+<Variable id="g" />
+<Function id="zz">
+<Parameter id="a" />
+<Parameter id="b" />
+<Parameter id="c" />
+<Scope>
+<Scope>
+<Variable id="a" />
+</Scope>
+<Scope>
+<Variable id="fsdfsdfs" />
+</Scope>
+</Scope>
+</Function>
+</Program>
diff --git a/c_parser/test/ref/07.stdout.xml b/c_parser/test/ref/07.stdout.xml
index baedd20..ff0efb2 100644
--- a/c_parser/test/ref/07.stdout.xml
+++ b/c_parser/test/ref/07.stdout.xml
@@ -1,6 +1,11 @@
<?xml version="1.0"?>
<Program>
+<Function id="foo">
+<Parameter id="a" />
+<Scope>
<Scope>
<Variable id="z" />
</Scope>
+</Scope>
+</Function>
</Program>
diff --git a/c_parser/test/ref/08.stdout.xml b/c_parser/test/ref/08.stdout.xml
new file mode 100644
index 0000000..7929e75
--- /dev/null
+++ b/c_parser/test/ref/08.stdout.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<Program>
+<Function id="func">
+<Parameter id="a" />
+<Parameter id="b" />
+<Scope>
+<Variable id="c" />
+<Scope>
+<Variable id="d" />
+</Scope>
+<Scope>
+<Variable id="e" />
+</Scope>
+</Scope>
+</Function>
+</Program>
diff --git a/c_parser/test/ref/09.stdout.xml b/c_parser/test/ref/09.stdout.xml
new file mode 100644
index 0000000..7a7a770
--- /dev/null
+++ b/c_parser/test/ref/09.stdout.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<Program>
+<Function id="x">
+<Scope>
+</Scope>
+</Function>
+<Variable id="g" />
+<Function id="zz">
+<Parameter id="a" />
+<Parameter id="b" />
+<Parameter id="c" />
+<Scope>
+<Scope>
+<Variable id="a" />
+</Scope>
+<Scope>
+<Variable id="fsdfsdfs" />
+</Scope>
+</Scope>
+</Function>
+</Program>