diff options
70 files changed, 384 insertions, 8 deletions
@@ -4,7 +4,4 @@ glcpp-parse.c glcpp-parse.h *.o *~ -tests/*.expected -tests/*.gcc -tests/*.glcpp tests/*.out @@ -22,4 +22,4 @@ test: glcpp clean: rm -f glcpp glcpp-lex.c glcpp-parse.c *.o *~ - rm -f tests/*.out tests/*.gcc tests/*.expected tests/*~ + rm -f tests/*.out tests/*~ diff --git a/tests/000-content-with-spaces.c.expected b/tests/000-content-with-spaces.c.expected new file mode 100644 index 0000000..a7fc918 --- /dev/null +++ b/tests/000-content-with-spaces.c.expected @@ -0,0 +1 @@ +this is four tokens diff --git a/tests/001-define.c.expected b/tests/001-define.c.expected new file mode 100644 index 0000000..a464d9d --- /dev/null +++ b/tests/001-define.c.expected @@ -0,0 +1,2 @@ + +1 diff --git a/tests/002-define-chain.c.expected b/tests/002-define-chain.c.expected new file mode 100644 index 0000000..c6c9ee3 --- /dev/null +++ b/tests/002-define-chain.c.expected @@ -0,0 +1,3 @@ + + +1 diff --git a/tests/003-define-chain-reverse.c.expected b/tests/003-define-chain-reverse.c.expected new file mode 100644 index 0000000..c6c9ee3 --- /dev/null +++ b/tests/003-define-chain-reverse.c.expected @@ -0,0 +1,3 @@ + + +1 diff --git a/tests/004-define-recursive.c.expected b/tests/004-define-recursive.c.expected new file mode 100644 index 0000000..2d07687 --- /dev/null +++ b/tests/004-define-recursive.c.expected @@ -0,0 +1,6 @@ + + + +foo +bar +baz diff --git a/tests/005-define-composite-chain.c.expected b/tests/005-define-composite-chain.c.expected new file mode 100644 index 0000000..892975c --- /dev/null +++ b/tests/005-define-composite-chain.c.expected @@ -0,0 +1,3 @@ + + +a 1 diff --git a/tests/006-define-composite-chain-reverse.c.expected b/tests/006-define-composite-chain-reverse.c.expected new file mode 100644 index 0000000..892975c --- /dev/null +++ b/tests/006-define-composite-chain-reverse.c.expected @@ -0,0 +1,3 @@ + + +a 1 diff --git a/tests/007-define-composite-recursive.c.expected b/tests/007-define-composite-recursive.c.expected new file mode 100644 index 0000000..0b0b477 --- /dev/null +++ b/tests/007-define-composite-recursive.c.expected @@ -0,0 +1,6 @@ + + + +a b c foo +b c a bar +c a b baz diff --git a/tests/008-define-empty.c.expected b/tests/008-define-empty.c.expected new file mode 100644 index 0000000..139597f --- /dev/null +++ b/tests/008-define-empty.c.expected @@ -0,0 +1,2 @@ + + diff --git a/tests/009-undef.c.expected b/tests/009-undef.c.expected new file mode 100644 index 0000000..9c0b35a --- /dev/null +++ b/tests/009-undef.c.expected @@ -0,0 +1,4 @@ + +1 + +foo diff --git a/tests/010-undef-re-define.c.expected b/tests/010-undef-re-define.c.expected new file mode 100644 index 0000000..5970f49 --- /dev/null +++ b/tests/010-undef-re-define.c.expected @@ -0,0 +1,6 @@ + +1 + +foo + +2 diff --git a/tests/011-define-func-empty.c.expected b/tests/011-define-func-empty.c.expected new file mode 100644 index 0000000..139597f --- /dev/null +++ b/tests/011-define-func-empty.c.expected @@ -0,0 +1,2 @@ + + diff --git a/tests/012-define-func-no-args.c.expected b/tests/012-define-func-no-args.c.expected new file mode 100644 index 0000000..9f075f2 --- /dev/null +++ b/tests/012-define-func-no-args.c.expected @@ -0,0 +1,2 @@ + +bar diff --git a/tests/013-define-func-1-arg-unused.c.expected b/tests/013-define-func-1-arg-unused.c.expected new file mode 100644 index 0000000..a464d9d --- /dev/null +++ b/tests/013-define-func-1-arg-unused.c.expected @@ -0,0 +1,2 @@ + +1 diff --git a/tests/014-define-func-2-arg-unused.c.expected b/tests/014-define-func-2-arg-unused.c.expected new file mode 100644 index 0000000..a464d9d --- /dev/null +++ b/tests/014-define-func-2-arg-unused.c.expected @@ -0,0 +1,2 @@ + +1 diff --git a/tests/015-define-object-with-parens.c.expected b/tests/015-define-object-with-parens.c.expected new file mode 100644 index 0000000..a70321a --- /dev/null +++ b/tests/015-define-object-with-parens.c.expected @@ -0,0 +1,4 @@ + +()1() + +()2() diff --git a/tests/016-define-func-1-arg.c.expected b/tests/016-define-func-1-arg.c.expected new file mode 100644 index 0000000..6bfe04f --- /dev/null +++ b/tests/016-define-func-1-arg.c.expected @@ -0,0 +1,2 @@ + +((bar)+1) diff --git a/tests/017-define-func-2-args.c.expected b/tests/017-define-func-2-args.c.expected new file mode 100644 index 0000000..f7a2b8c --- /dev/null +++ b/tests/017-define-func-2-args.c.expected @@ -0,0 +1,2 @@ + +((bar)*(baz)) diff --git a/tests/018-define-func-macro-as-parameter.c.expected b/tests/018-define-func-macro-as-parameter.c.expected new file mode 100644 index 0000000..c6c9ee3 --- /dev/null +++ b/tests/018-define-func-macro-as-parameter.c.expected @@ -0,0 +1,3 @@ + + +1 diff --git a/tests/019-define-func-1-arg-multi.c.expected b/tests/019-define-func-1-arg-multi.c.expected new file mode 100644 index 0000000..1e89b8c --- /dev/null +++ b/tests/019-define-func-1-arg-multi.c.expected @@ -0,0 +1,2 @@ + +(this is more than one word) diff --git a/tests/020-define-func-2-arg-multi.c.expected b/tests/020-define-func-2-arg-multi.c.expected new file mode 100644 index 0000000..19f59f5 --- /dev/null +++ b/tests/020-define-func-2-arg-multi.c.expected @@ -0,0 +1,2 @@ + +one fish,two fish,red fish,blue fish diff --git a/tests/021-define-func-compose.c.expected b/tests/021-define-func-compose.c.expected new file mode 100644 index 0000000..87f51f0 --- /dev/null +++ b/tests/021-define-func-compose.c.expected @@ -0,0 +1,3 @@ + + +(2*((1+(3)))) diff --git a/tests/022-define-func-arg-with-parens.c.expected b/tests/022-define-func-arg-with-parens.c.expected new file mode 100644 index 0000000..1dfc669 --- /dev/null +++ b/tests/022-define-func-arg-with-parens.c.expected @@ -0,0 +1,2 @@ + +(argument(including parens)for the win) diff --git a/tests/023-define-extra-whitespace.c.expected b/tests/023-define-extra-whitespace.c.expected new file mode 100644 index 0000000..9c58275 --- /dev/null +++ b/tests/023-define-extra-whitespace.c.expected @@ -0,0 +1,8 @@ + + + + +1 +2 +3 4 +5 6 7 diff --git a/tests/024-define-chain-to-self-recursion.c.expected b/tests/024-define-chain-to-self-recursion.c.expected new file mode 100644 index 0000000..15600af --- /dev/null +++ b/tests/024-define-chain-to-self-recursion.c.expected @@ -0,0 +1,3 @@ + + +foo diff --git a/tests/025-func-macro-as-non-macro.c.expected b/tests/025-func-macro-as-non-macro.c.expected new file mode 100644 index 0000000..4a59f05 --- /dev/null +++ b/tests/025-func-macro-as-non-macro.c.expected @@ -0,0 +1,2 @@ + +foo bar diff --git a/tests/026-define-func-extra-newlines.c.expected b/tests/026-define-func-extra-newlines.c.expected new file mode 100644 index 0000000..5e3c70f --- /dev/null +++ b/tests/026-define-func-extra-newlines.c.expected @@ -0,0 +1,3 @@ + + +bar diff --git a/tests/027-define-chain-obj-to-func.c.expected b/tests/027-define-chain-obj-to-func.c.expected new file mode 100644 index 0000000..94c15f9 --- /dev/null +++ b/tests/027-define-chain-obj-to-func.c.expected @@ -0,0 +1,3 @@ + + +success diff --git a/tests/028-define-chain-obj-to-non-func.c.expected b/tests/028-define-chain-obj-to-non-func.c.expected new file mode 100644 index 0000000..94c15f9 --- /dev/null +++ b/tests/028-define-chain-obj-to-non-func.c.expected @@ -0,0 +1,3 @@ + + +success diff --git a/tests/029-define-chain-obj-to-func-with-args.c.expected b/tests/029-define-chain-obj-to-func-with-args.c.expected new file mode 100644 index 0000000..94c15f9 --- /dev/null +++ b/tests/029-define-chain-obj-to-func-with-args.c.expected @@ -0,0 +1,3 @@ + + +success diff --git a/tests/030-define-chain-obj-to-func-compose.c.expected b/tests/030-define-chain-obj-to-func-compose.c.expected new file mode 100644 index 0000000..bed826e --- /dev/null +++ b/tests/030-define-chain-obj-to-func-compose.c.expected @@ -0,0 +1,4 @@ + + + +success diff --git a/tests/031-define-chain-func-to-func-compose.c.expected b/tests/031-define-chain-func-to-func-compose.c.expected new file mode 100644 index 0000000..bed826e --- /dev/null +++ b/tests/031-define-chain-func-to-func-compose.c.expected @@ -0,0 +1,4 @@ + + + +success diff --git a/tests/032-define-func-self-recurse.c.expected b/tests/032-define-func-self-recurse.c.expected new file mode 100644 index 0000000..983f941 --- /dev/null +++ b/tests/032-define-func-self-recurse.c.expected @@ -0,0 +1,2 @@ + +foo(2*(3)) diff --git a/tests/033-define-func-self-compose.c.expected b/tests/033-define-func-self-compose.c.expected new file mode 100644 index 0000000..0818362 --- /dev/null +++ b/tests/033-define-func-self-compose.c.expected @@ -0,0 +1,2 @@ + +foo(2*(foo(2*(3)))) diff --git a/tests/034-define-func-self-compose-non-func.c.expected b/tests/034-define-func-self-compose-non-func.c.expected new file mode 100644 index 0000000..3f808fe --- /dev/null +++ b/tests/034-define-func-self-compose-non-func.c.expected @@ -0,0 +1,2 @@ + +foo diff --git a/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected b/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected new file mode 100644 index 0000000..09dfdd6 --- /dev/null +++ b/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected @@ -0,0 +1,2 @@ + +1+foo diff --git a/tests/036-define-func-non-macro-multi-token-argument.c.expected b/tests/036-define-func-non-macro-multi-token-argument.c.expected new file mode 100644 index 0000000..580ed95 --- /dev/null +++ b/tests/036-define-func-non-macro-multi-token-argument.c.expected @@ -0,0 +1,3 @@ + + +more success diff --git a/tests/037-finalize-unexpanded-macro.c.expected b/tests/037-finalize-unexpanded-macro.c.expected new file mode 100644 index 0000000..e804d7e --- /dev/null +++ b/tests/037-finalize-unexpanded-macro.c.expected @@ -0,0 +1,3 @@ + + +expand(just once) diff --git a/tests/038-func-arg-with-commas.c.expected b/tests/038-func-arg-with-commas.c.expected new file mode 100644 index 0000000..6544adb --- /dev/null +++ b/tests/038-func-arg-with-commas.c.expected @@ -0,0 +1,2 @@ + +success diff --git a/tests/039-func-arg-obj-macro-with-comma.c.expected b/tests/039-func-arg-obj-macro-with-comma.c.expected new file mode 100644 index 0000000..8a15397 --- /dev/null +++ b/tests/039-func-arg-obj-macro-with-comma.c.expected @@ -0,0 +1,3 @@ + + +(two,words) diff --git a/tests/040-token-pasting.c.expected b/tests/040-token-pasting.c.expected new file mode 100644 index 0000000..48e836e --- /dev/null +++ b/tests/040-token-pasting.c.expected @@ -0,0 +1,2 @@ + +onetoken diff --git a/tests/041-if-0.c.expected b/tests/041-if-0.c.expected new file mode 100644 index 0000000..8b506b3 --- /dev/null +++ b/tests/041-if-0.c.expected @@ -0,0 +1,5 @@ +success_1 + + + +success_2 diff --git a/tests/042-if-1.c.expected b/tests/042-if-1.c.expected new file mode 100644 index 0000000..a6ae946 --- /dev/null +++ b/tests/042-if-1.c.expected @@ -0,0 +1,5 @@ +success_1 + +success_2 + +success_3 diff --git a/tests/043-if-0-else.c.expected b/tests/043-if-0-else.c.expected new file mode 100644 index 0000000..3d7e6be --- /dev/null +++ b/tests/043-if-0-else.c.expected @@ -0,0 +1,7 @@ +success_1 + + + +success_2 + +success_3 diff --git a/tests/044-if-1-else.c.expected b/tests/044-if-1-else.c.expected new file mode 100644 index 0000000..4a31e1c --- /dev/null +++ b/tests/044-if-1-else.c.expected @@ -0,0 +1,7 @@ +success_1 + +success_2 + + + +success_3 diff --git a/tests/045-if-0-elif.c.expected b/tests/045-if-0-elif.c.expected new file mode 100644 index 0000000..a9bb158 --- /dev/null +++ b/tests/045-if-0-elif.c.expected @@ -0,0 +1,11 @@ +success_1 + + + + + +success_3 + + + +success_4 diff --git a/tests/046-if-1-elsif.c.expected b/tests/046-if-1-elsif.c.expected new file mode 100644 index 0000000..a499571 --- /dev/null +++ b/tests/046-if-1-elsif.c.expected @@ -0,0 +1,11 @@ +success_1 + +success_2 + + + + + + + +success_3 diff --git a/tests/047-if-elif-else.c.expected b/tests/047-if-elif-else.c.expected new file mode 100644 index 0000000..54d3086 --- /dev/null +++ b/tests/047-if-elif-else.c.expected @@ -0,0 +1,11 @@ +success_1 + + + + + + + +success_2 + +success_3 diff --git a/tests/048-if-nested.c.expected b/tests/048-if-nested.c.expected new file mode 100644 index 0000000..8beb9c3 --- /dev/null +++ b/tests/048-if-nested.c.expected @@ -0,0 +1,11 @@ +success_1 + + + + + + + + + +success_2 diff --git a/tests/049-if-expression-precedence.c.expected b/tests/049-if-expression-precedence.c.expected new file mode 100644 index 0000000..729bdd1 --- /dev/null +++ b/tests/049-if-expression-precedence.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/tests/050-if-defined.c.expected b/tests/050-if-defined.c.expected new file mode 100644 index 0000000..737eb8d --- /dev/null +++ b/tests/050-if-defined.c.expected @@ -0,0 +1,17 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + diff --git a/tests/051-if-relational.c.expected b/tests/051-if-relational.c.expected new file mode 100644 index 0000000..652fefd --- /dev/null +++ b/tests/051-if-relational.c.expected @@ -0,0 +1,35 @@ + + + +success_1 + + + +success_2 + + + + + +success_3 + + + + + +success_3 + + + + + + + +success_4 + + + +success_5 + + + diff --git a/tests/052-if-bitwise.c.expected b/tests/052-if-bitwise.c.expected new file mode 100644 index 0000000..44e52b2 --- /dev/null +++ b/tests/052-if-bitwise.c.expected @@ -0,0 +1,20 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + +success_4 + + + diff --git a/tests/053-if-divide-and-shift.c.expected b/tests/053-if-divide-and-shift.c.expected new file mode 100644 index 0000000..7e78e04 --- /dev/null +++ b/tests/053-if-divide-and-shift.c.expected @@ -0,0 +1,15 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + diff --git a/tests/054-if-with-macros.c.expected b/tests/054-if-with-macros.c.expected new file mode 100644 index 0000000..70f737c --- /dev/null +++ b/tests/054-if-with-macros.c.expected @@ -0,0 +1,34 @@ + + + + + + + +success_1 + + +success_2 + + + + +success_3 + + + + +success_4 + + + + + + +success_5 + + +success_6 + + + diff --git a/tests/055-define-chain-obj-to-func-parens-in-text.c.expected b/tests/055-define-chain-obj-to-func-parens-in-text.c.expected new file mode 100644 index 0000000..94c15f9 --- /dev/null +++ b/tests/055-define-chain-obj-to-func-parens-in-text.c.expected @@ -0,0 +1,3 @@ + + +success diff --git a/tests/056-macro-argument-with-comma.c.expected b/tests/056-macro-argument-with-comma.c.expected new file mode 100644 index 0000000..bed826e --- /dev/null +++ b/tests/056-macro-argument-with-comma.c.expected @@ -0,0 +1,4 @@ + + + +success diff --git a/tests/057-empty-arguments.c.expected b/tests/057-empty-arguments.c.expected new file mode 100644 index 0000000..7d97e15 --- /dev/null +++ b/tests/057-empty-arguments.c.expected @@ -0,0 +1,6 @@ + +success + +success + +success diff --git a/tests/058-token-pasting-empty-arguments.c.expected b/tests/058-token-pasting-empty-arguments.c.expected new file mode 100644 index 0000000..e0967a1 --- /dev/null +++ b/tests/058-token-pasting-empty-arguments.c.expected @@ -0,0 +1,5 @@ + +ab +a +b + diff --git a/tests/059-token-pasting-integer.c.expected b/tests/059-token-pasting-integer.c.expected new file mode 100644 index 0000000..f1288aa --- /dev/null +++ b/tests/059-token-pasting-integer.c.expected @@ -0,0 +1,4 @@ + +12 +1000 +identifier2 diff --git a/tests/060-left-paren-in-macro-right-paren-in-text.c.expected b/tests/060-left-paren-in-macro-right-paren-in-text.c.expected new file mode 100644 index 0000000..3e5501a --- /dev/null +++ b/tests/060-left-paren-in-macro-right-paren-in-text.c.expected @@ -0,0 +1,3 @@ + + +5*2 diff --git a/tests/061-define-chain-obj-to-func-multi.c.expected b/tests/061-define-chain-obj-to-func-multi.c.expected new file mode 100644 index 0000000..15eb64b --- /dev/null +++ b/tests/061-define-chain-obj-to-func-multi.c.expected @@ -0,0 +1,5 @@ + + + + +success diff --git a/tests/062-if-0-skips-garbage.c.expected b/tests/062-if-0-skips-garbage.c.expected new file mode 100644 index 0000000..3f2ff2d --- /dev/null +++ b/tests/062-if-0-skips-garbage.c.expected @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/063-comments.c.expected b/tests/063-comments.c.expected new file mode 100644 index 0000000..4998d76 --- /dev/null +++ b/tests/063-comments.c.expected @@ -0,0 +1,13 @@ + + + +f = g /h; + l(); +m = n ++ p; + +more code here + +are not treated like comments. + + diff --git a/tests/071-punctuator.c.expected b/tests/071-punctuator.c.expected new file mode 100644 index 0000000..959d682 --- /dev/null +++ b/tests/071-punctuator.c.expected @@ -0,0 +1 @@ +a = b diff --git a/tests/072-token-pasting-same-line.c.expected b/tests/072-token-pasting-same-line.c.expected new file mode 100644 index 0000000..7b80af7 --- /dev/null +++ b/tests/072-token-pasting-same-line.c.expected @@ -0,0 +1,2 @@ + +success_1 success_2 success_3 diff --git a/tests/099-c99-example.c.expected b/tests/099-c99-example.c.expected new file mode 100644 index 0000000..352bbff --- /dev/null +++ b/tests/099-c99-example.c.expected @@ -0,0 +1,16 @@ + + + + + + + + + + + + + +f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); +int i[] = { 1, 23, 4, 5, }; diff --git a/tests/glcpp-test b/tests/glcpp-test index 2411033..396f6e1 100755 --- a/tests/glcpp-test +++ b/tests/glcpp-test @@ -2,9 +2,6 @@ for test in *.c; do echo "Testing $test" - ../glcpp < $test > $test.glcpp - grep -v '^ *$' < $test.glcpp > $test.out || true - gcc -E $test -o $test.gcc - grep -v '^#' < $test.gcc | grep -v '^$' | sed -r -e 's/^ +/ /' > $test.expected || true + ../glcpp < $test > $test.out diff -u $test.expected $test.out done |