diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-02-17 17:27:38 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-02-17 17:27:38 +0000 |
commit | c85746b6a6c3080bac409e0acb8cc8b332b2761e (patch) | |
tree | 7e37429cbe6014e2ed6aba6466b69cf914e2af38 /c_parser/test | |
parent | b81f60d8b523260526af15361d4ce0ac4a7757c8 (diff) | |
download | Compiler-c85746b6a6c3080bac409e0acb8cc8b332b2761e.tar.gz Compiler-c85746b6a6c3080bac409e0acb8cc8b332b2761e.zip |
Finished compound statement for function and added test cases
Diffstat (limited to 'c_parser/test')
-rw-r--r-- | c_parser/test/in/01.c | 6 | ||||
-rw-r--r-- | c_parser/test/in/02.c | 1 | ||||
-rw-r--r-- | c_parser/test/in/03.c | 1 | ||||
-rw-r--r-- | c_parser/test/in/04.c | 4 | ||||
-rw-r--r-- | c_parser/test/out/01.diff.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/01.stderr.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/01.stdout.txt | 9 | ||||
-rw-r--r-- | c_parser/test/out/02.diff.txt | 8 | ||||
-rw-r--r-- | c_parser/test/out/02.stderr.txt | 1 | ||||
-rw-r--r-- | c_parser/test/out/02.stdout.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/03.diff.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/03.stderr.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/03.stdout.txt | 8 | ||||
-rw-r--r-- | c_parser/test/out/04.diff.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/04.stderr.txt | 0 | ||||
-rw-r--r-- | c_parser/test/out/04.stdout.txt | 12 | ||||
-rw-r--r-- | c_parser/test/output.xml | 37 | ||||
-rw-r--r-- | c_parser/test/ref/01.stdout.txt | 9 | ||||
-rw-r--r-- | c_parser/test/ref/02.stdout.txt | 7 | ||||
-rw-r--r-- | c_parser/test/ref/03.stdout.txt | 8 | ||||
-rw-r--r-- | c_parser/test/ref/04.stdout.txt | 12 | ||||
-rw-r--r-- | c_parser/test/test_parser.c | 16 |
22 files changed, 86 insertions, 53 deletions
diff --git a/c_parser/test/in/01.c b/c_parser/test/in/01.c new file mode 100644 index 0000000..76425b5 --- /dev/null +++ b/c_parser/test/in/01.c @@ -0,0 +1,6 @@ +int a; +int b = 0; +int c, d; + +int e, + f; diff --git a/c_parser/test/in/02.c b/c_parser/test/in/02.c new file mode 100644 index 0000000..45b1467 --- /dev/null +++ b/c_parser/test/in/02.c @@ -0,0 +1 @@ +int f() {} diff --git a/c_parser/test/in/03.c b/c_parser/test/in/03.c new file mode 100644 index 0000000..e57aaa9 --- /dev/null +++ b/c_parser/test/in/03.c @@ -0,0 +1 @@ +int foo(int bar) {} diff --git a/c_parser/test/in/04.c b/c_parser/test/in/04.c new file mode 100644 index 0000000..0e50c88 --- /dev/null +++ b/c_parser/test/in/04.c @@ -0,0 +1,4 @@ +int foo(int bar1, int bar2) { + int x; + int y, z; +} diff --git a/c_parser/test/out/01.diff.txt b/c_parser/test/out/01.diff.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/01.diff.txt diff --git a/c_parser/test/out/01.stderr.txt b/c_parser/test/out/01.stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/01.stderr.txt diff --git a/c_parser/test/out/01.stdout.txt b/c_parser/test/out/01.stdout.txt new file mode 100644 index 0000000..bd7cd1f --- /dev/null +++ b/c_parser/test/out/01.stdout.txt @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<Program> +<Variable id="a" /> +<Variable id="b" /> +<Variable id="c" /> +<Variable id="d" /> +<Variable id="e" /> +<Variable id="f" /> +</Program> diff --git a/c_parser/test/out/02.diff.txt b/c_parser/test/out/02.diff.txt new file mode 100644 index 0000000..09321ae --- /dev/null +++ b/c_parser/test/out/02.diff.txt @@ -0,0 +1,8 @@ +1,7d0 +< <?xml version="1.0"?> +< <Program> +< <Function id="f"> +< <Scope> +< </Scope> +< </Function> +< </Program> diff --git a/c_parser/test/out/02.stderr.txt b/c_parser/test/out/02.stderr.txt new file mode 100644 index 0000000..6200509 --- /dev/null +++ b/c_parser/test/out/02.stderr.txt @@ -0,0 +1 @@ +Parse error : syntax error diff --git a/c_parser/test/out/02.stdout.txt b/c_parser/test/out/02.stdout.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/02.stdout.txt diff --git a/c_parser/test/out/03.diff.txt b/c_parser/test/out/03.diff.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/03.diff.txt diff --git a/c_parser/test/out/03.stderr.txt b/c_parser/test/out/03.stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/03.stderr.txt diff --git a/c_parser/test/out/03.stdout.txt b/c_parser/test/out/03.stdout.txt new file mode 100644 index 0000000..6ca0ab2 --- /dev/null +++ b/c_parser/test/out/03.stdout.txt @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<Program> +<Function id="foo"> +<Parameter id="bar" /> +<Scope> +</Scope> +</Function> +</Program> diff --git a/c_parser/test/out/04.diff.txt b/c_parser/test/out/04.diff.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/04.diff.txt diff --git a/c_parser/test/out/04.stderr.txt b/c_parser/test/out/04.stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/c_parser/test/out/04.stderr.txt diff --git a/c_parser/test/out/04.stdout.txt b/c_parser/test/out/04.stdout.txt new file mode 100644 index 0000000..9257eac --- /dev/null +++ b/c_parser/test/out/04.stdout.txt @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<Program> +<Function id="foo"> +<Parameter id="bar1" /> +<Parameter id="bar2" /> +<Scope> +<Variable id="x" /> +<Variable id="y" /> +<Variable id="z" /> +</Scope> +</Function> +</Program> diff --git a/c_parser/test/output.xml b/c_parser/test/output.xml deleted file mode 100644 index d4594a2..0000000 --- a/c_parser/test/output.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?> -<Program> -<Variable id="a" /> -<Variable id="b" /> -<Variable id="c" /> -<Variable id="yann" /> -<Variable id="is" /> -<Variable id="the" /> -<Variable id="best" /> -<Variable id="d" /> -<Variable id="hello" /> -<Variable id="asd" /> -<Variable id="a" /> -<Function id="f"> -<Parameter id="i" /> -<Parameter id="b" /> -<Parameter id="c" /> -<Parameter id="d" /> -<Scope> -<Variable id="a" /> -</Scope> -</Function> -<Variable id="a" /> -<Variable id="b" /> -<Variable id="c" /> -<Variable id="c" /> -<Variable id="d" /> -<Function id="func"> -<Parameter id="asd" /> -<Parameter id="b" /> -<Scope> -<Variable id="a" /> -<Variable id="b" /> -<Variable id="c" /> -</Scope> -</Function> -</Program> diff --git a/c_parser/test/ref/01.stdout.txt b/c_parser/test/ref/01.stdout.txt new file mode 100644 index 0000000..bd7cd1f --- /dev/null +++ b/c_parser/test/ref/01.stdout.txt @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<Program> +<Variable id="a" /> +<Variable id="b" /> +<Variable id="c" /> +<Variable id="d" /> +<Variable id="e" /> +<Variable id="f" /> +</Program> diff --git a/c_parser/test/ref/02.stdout.txt b/c_parser/test/ref/02.stdout.txt new file mode 100644 index 0000000..bc37d7a --- /dev/null +++ b/c_parser/test/ref/02.stdout.txt @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<Program> +<Function id="f"> +<Scope> +</Scope> +</Function> +</Program> diff --git a/c_parser/test/ref/03.stdout.txt b/c_parser/test/ref/03.stdout.txt new file mode 100644 index 0000000..6ca0ab2 --- /dev/null +++ b/c_parser/test/ref/03.stdout.txt @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<Program> +<Function id="foo"> +<Parameter id="bar" /> +<Scope> +</Scope> +</Function> +</Program> diff --git a/c_parser/test/ref/04.stdout.txt b/c_parser/test/ref/04.stdout.txt new file mode 100644 index 0000000..9257eac --- /dev/null +++ b/c_parser/test/ref/04.stdout.txt @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<Program> +<Function id="foo"> +<Parameter id="bar1" /> +<Parameter id="bar2" /> +<Scope> +<Variable id="x" /> +<Variable id="y" /> +<Variable id="z" /> +</Scope> +</Function> +</Program> diff --git a/c_parser/test/test_parser.c b/c_parser/test/test_parser.c deleted file mode 100644 index 55a15b7..0000000 --- a/c_parser/test/test_parser.c +++ /dev/null @@ -1,16 +0,0 @@ -int a; -int b; -int c; -int yann, is, the, best; -int d = 0; -int hello = 122, asd = 123; - -int f(int i, int b, int c, int d) { - int a; -} - -int func(int asd, int b) { - int a, b, c; - int c = 0; - int d; -} |