diff options
Diffstat (limited to 'src/glsl/glcpp/tests')
176 files changed, 1163 insertions, 0 deletions
diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c b/src/glsl/glcpp/tests/000-content-with-spaces.c new file mode 100644 index 00000000000..696cb3a74fc --- /dev/null +++ b/src/glsl/glcpp/tests/000-content-with-spaces.c @@ -0,0 +1 @@ +this is four tokens diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c.expected b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected new file mode 100644 index 00000000000..83f7834d547 --- /dev/null +++ b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected @@ -0,0 +1,2 @@ +this is four tokens + diff --git a/src/glsl/glcpp/tests/001-define.c b/src/glsl/glcpp/tests/001-define.c new file mode 100644 index 00000000000..cbf2fee0e75 --- /dev/null +++ b/src/glsl/glcpp/tests/001-define.c @@ -0,0 +1,2 @@ +#define foo 1 +foo diff --git a/src/glsl/glcpp/tests/001-define.c.expected b/src/glsl/glcpp/tests/001-define.c.expected new file mode 100644 index 00000000000..878fd15d6f8 --- /dev/null +++ b/src/glsl/glcpp/tests/001-define.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/002-define-chain.c b/src/glsl/glcpp/tests/002-define-chain.c new file mode 100644 index 00000000000..87d75c68751 --- /dev/null +++ b/src/glsl/glcpp/tests/002-define-chain.c @@ -0,0 +1,3 @@ +#define foo 1 +#define bar foo +bar diff --git a/src/glsl/glcpp/tests/002-define-chain.c.expected b/src/glsl/glcpp/tests/002-define-chain.c.expected new file mode 100644 index 00000000000..43d484d7131 --- /dev/null +++ b/src/glsl/glcpp/tests/002-define-chain.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/003-define-chain-reverse.c b/src/glsl/glcpp/tests/003-define-chain-reverse.c new file mode 100644 index 00000000000..a18b724eca0 --- /dev/null +++ b/src/glsl/glcpp/tests/003-define-chain-reverse.c @@ -0,0 +1,3 @@ +#define bar foo +#define foo 1 +bar diff --git a/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected b/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected new file mode 100644 index 00000000000..43d484d7131 --- /dev/null +++ b/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/004-define-recursive.c b/src/glsl/glcpp/tests/004-define-recursive.c new file mode 100644 index 00000000000..2ac56ea3dcf --- /dev/null +++ b/src/glsl/glcpp/tests/004-define-recursive.c @@ -0,0 +1,6 @@ +#define foo bar +#define bar baz +#define baz foo +foo +bar +baz diff --git a/src/glsl/glcpp/tests/004-define-recursive.c.expected b/src/glsl/glcpp/tests/004-define-recursive.c.expected new file mode 100644 index 00000000000..4d2698b7a7f --- /dev/null +++ b/src/glsl/glcpp/tests/004-define-recursive.c.expected @@ -0,0 +1,7 @@ + + + +foo +bar +baz + diff --git a/src/glsl/glcpp/tests/005-define-composite-chain.c b/src/glsl/glcpp/tests/005-define-composite-chain.c new file mode 100644 index 00000000000..f5521df968d --- /dev/null +++ b/src/glsl/glcpp/tests/005-define-composite-chain.c @@ -0,0 +1,3 @@ +#define foo 1 +#define bar a foo +bar diff --git a/src/glsl/glcpp/tests/005-define-composite-chain.c.expected b/src/glsl/glcpp/tests/005-define-composite-chain.c.expected new file mode 100644 index 00000000000..c67358f4f69 --- /dev/null +++ b/src/glsl/glcpp/tests/005-define-composite-chain.c.expected @@ -0,0 +1,4 @@ + + +a 1 + diff --git a/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c new file mode 100644 index 00000000000..4bb91a1221a --- /dev/null +++ b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c @@ -0,0 +1,3 @@ +#define bar a foo +#define foo 1 +bar diff --git a/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected new file mode 100644 index 00000000000..c67358f4f69 --- /dev/null +++ b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected @@ -0,0 +1,4 @@ + + +a 1 + diff --git a/src/glsl/glcpp/tests/007-define-composite-recursive.c b/src/glsl/glcpp/tests/007-define-composite-recursive.c new file mode 100644 index 00000000000..5784565bdf3 --- /dev/null +++ b/src/glsl/glcpp/tests/007-define-composite-recursive.c @@ -0,0 +1,6 @@ +#define foo a bar +#define bar b baz +#define baz c foo +foo +bar +baz diff --git a/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected b/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected new file mode 100644 index 00000000000..30fe4dc1f62 --- /dev/null +++ b/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected @@ -0,0 +1,7 @@ + + + +a b c foo +b c a bar +c a b baz + diff --git a/src/glsl/glcpp/tests/008-define-empty.c b/src/glsl/glcpp/tests/008-define-empty.c new file mode 100644 index 00000000000..b1bd17ec215 --- /dev/null +++ b/src/glsl/glcpp/tests/008-define-empty.c @@ -0,0 +1,2 @@ +#define foo +foo diff --git a/src/glsl/glcpp/tests/008-define-empty.c.expected b/src/glsl/glcpp/tests/008-define-empty.c.expected new file mode 100644 index 00000000000..c0f53d75c71 --- /dev/null +++ b/src/glsl/glcpp/tests/008-define-empty.c.expected @@ -0,0 +1,3 @@ + + + diff --git a/src/glsl/glcpp/tests/009-undef.c b/src/glsl/glcpp/tests/009-undef.c new file mode 100644 index 00000000000..3fc1fb44243 --- /dev/null +++ b/src/glsl/glcpp/tests/009-undef.c @@ -0,0 +1,4 @@ +#define foo 1 +foo +#undef foo +foo diff --git a/src/glsl/glcpp/tests/009-undef.c.expected b/src/glsl/glcpp/tests/009-undef.c.expected new file mode 100644 index 00000000000..03a7061af03 --- /dev/null +++ b/src/glsl/glcpp/tests/009-undef.c.expected @@ -0,0 +1,5 @@ + +1 + +foo + diff --git a/src/glsl/glcpp/tests/010-undef-re-define.c b/src/glsl/glcpp/tests/010-undef-re-define.c new file mode 100644 index 00000000000..32ff73798b1 --- /dev/null +++ b/src/glsl/glcpp/tests/010-undef-re-define.c @@ -0,0 +1,6 @@ +#define foo 1 +foo +#undef foo +foo +#define foo 2 +foo diff --git a/src/glsl/glcpp/tests/010-undef-re-define.c.expected b/src/glsl/glcpp/tests/010-undef-re-define.c.expected new file mode 100644 index 00000000000..f4f7efdc2bf --- /dev/null +++ b/src/glsl/glcpp/tests/010-undef-re-define.c.expected @@ -0,0 +1,7 @@ + +1 + +foo + +2 + diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c b/src/glsl/glcpp/tests/011-define-func-empty.c new file mode 100644 index 00000000000..d9ce13c2284 --- /dev/null +++ b/src/glsl/glcpp/tests/011-define-func-empty.c @@ -0,0 +1,2 @@ +#define foo() +foo() diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c.expected b/src/glsl/glcpp/tests/011-define-func-empty.c.expected new file mode 100644 index 00000000000..c0f53d75c71 --- /dev/null +++ b/src/glsl/glcpp/tests/011-define-func-empty.c.expected @@ -0,0 +1,3 @@ + + + diff --git a/src/glsl/glcpp/tests/012-define-func-no-args.c b/src/glsl/glcpp/tests/012-define-func-no-args.c new file mode 100644 index 00000000000..c2bb730b115 --- /dev/null +++ b/src/glsl/glcpp/tests/012-define-func-no-args.c @@ -0,0 +1,2 @@ +#define foo() bar +foo() diff --git a/src/glsl/glcpp/tests/012-define-func-no-args.c.expected b/src/glsl/glcpp/tests/012-define-func-no-args.c.expected new file mode 100644 index 00000000000..03537672974 --- /dev/null +++ b/src/glsl/glcpp/tests/012-define-func-no-args.c.expected @@ -0,0 +1,3 @@ + +bar + diff --git a/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c new file mode 100644 index 00000000000..f78fb8b118a --- /dev/null +++ b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c @@ -0,0 +1,2 @@ +#define foo(x) 1 +foo(bar) diff --git a/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected new file mode 100644 index 00000000000..878fd15d6f8 --- /dev/null +++ b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c new file mode 100644 index 00000000000..11feb2624b7 --- /dev/null +++ b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c @@ -0,0 +1,2 @@ +#define foo(x,y) 1 +foo(bar,baz) diff --git a/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected new file mode 100644 index 00000000000..878fd15d6f8 --- /dev/null +++ b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/015-define-object-with-parens.c b/src/glsl/glcpp/tests/015-define-object-with-parens.c new file mode 100644 index 00000000000..558da9c617b --- /dev/null +++ b/src/glsl/glcpp/tests/015-define-object-with-parens.c @@ -0,0 +1,4 @@ +#define foo ()1 +foo() +#define bar ()2 +bar() diff --git a/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected b/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected new file mode 100644 index 00000000000..d6f8cb9dc61 --- /dev/null +++ b/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected @@ -0,0 +1,5 @@ + +()1() + +()2() + diff --git a/src/glsl/glcpp/tests/016-define-func-1-arg.c b/src/glsl/glcpp/tests/016-define-func-1-arg.c new file mode 100644 index 00000000000..a2e2404c7c1 --- /dev/null +++ b/src/glsl/glcpp/tests/016-define-func-1-arg.c @@ -0,0 +1,2 @@ +#define foo(x) ((x)+1) +foo(bar) diff --git a/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected b/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected new file mode 100644 index 00000000000..7f1828a3c61 --- /dev/null +++ b/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected @@ -0,0 +1,3 @@ + +((bar)+1) + diff --git a/src/glsl/glcpp/tests/017-define-func-2-args.c b/src/glsl/glcpp/tests/017-define-func-2-args.c new file mode 100644 index 00000000000..c7253835278 --- /dev/null +++ b/src/glsl/glcpp/tests/017-define-func-2-args.c @@ -0,0 +1,2 @@ +#define foo(x,y) ((x)*(y)) +foo(bar,baz) diff --git a/src/glsl/glcpp/tests/017-define-func-2-args.c.expected b/src/glsl/glcpp/tests/017-define-func-2-args.c.expected new file mode 100644 index 00000000000..9f341dac00a --- /dev/null +++ b/src/glsl/glcpp/tests/017-define-func-2-args.c.expected @@ -0,0 +1,3 @@ + +((bar)*(baz)) + diff --git a/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c new file mode 100644 index 00000000000..668130b8f9b --- /dev/null +++ b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c @@ -0,0 +1,3 @@ +#define x 0 +#define foo(x) x +foo(1) diff --git a/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected new file mode 100644 index 00000000000..43d484d7131 --- /dev/null +++ b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c new file mode 100644 index 00000000000..c4e62b25508 --- /dev/null +++ b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c @@ -0,0 +1,2 @@ +#define foo(x) (x) +foo(this is more than one word) diff --git a/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected new file mode 100644 index 00000000000..4314fc88d83 --- /dev/null +++ b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected @@ -0,0 +1,3 @@ + +(this is more than one word) + diff --git a/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c new file mode 100644 index 00000000000..3049ad15465 --- /dev/null +++ b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c @@ -0,0 +1,2 @@ +#define foo(x,y) x,two fish,red fish,y +foo(one fish, blue fish) diff --git a/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected new file mode 100644 index 00000000000..5648e4fb9d4 --- /dev/null +++ b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected @@ -0,0 +1,3 @@ + +one fish,two fish,red fish,blue fish + diff --git a/src/glsl/glcpp/tests/021-define-func-compose.c b/src/glsl/glcpp/tests/021-define-func-compose.c new file mode 100644 index 00000000000..21ddd0e65f9 --- /dev/null +++ b/src/glsl/glcpp/tests/021-define-func-compose.c @@ -0,0 +1,3 @@ +#define bar(x) (1+(x)) +#define foo(y) (2*(y)) +foo(bar(3)) diff --git a/src/glsl/glcpp/tests/021-define-func-compose.c.expected b/src/glsl/glcpp/tests/021-define-func-compose.c.expected new file mode 100644 index 00000000000..1d62105de4c --- /dev/null +++ b/src/glsl/glcpp/tests/021-define-func-compose.c.expected @@ -0,0 +1,4 @@ + + +(2*((1+(3)))) + diff --git a/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c new file mode 100644 index 00000000000..c20d73a4a28 --- /dev/null +++ b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c @@ -0,0 +1,2 @@ +#define foo(x) (x) +foo(argument(including parens)for the win) diff --git a/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected new file mode 100644 index 00000000000..66c16581758 --- /dev/null +++ b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected @@ -0,0 +1,3 @@ + +(argument(including parens)for the win) + diff --git a/src/glsl/glcpp/tests/023-define-extra-whitespace.c b/src/glsl/glcpp/tests/023-define-extra-whitespace.c new file mode 100644 index 00000000000..7ebfed6516c --- /dev/null +++ b/src/glsl/glcpp/tests/023-define-extra-whitespace.c @@ -0,0 +1,8 @@ +#define noargs() 1 +# define onearg(foo) foo + # define twoargs( x , y ) x y + # define threeargs( a , b , c ) a b c +noargs ( ) +onearg ( 2 ) +twoargs ( 3 , 4 ) +threeargs ( 5 , 6 , 7 ) diff --git a/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected b/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected new file mode 100644 index 00000000000..573829c2d69 --- /dev/null +++ b/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected @@ -0,0 +1,9 @@ + + + + +1 +2 +3 4 +5 6 7 + diff --git a/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c new file mode 100644 index 00000000000..e788adce30c --- /dev/null +++ b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c @@ -0,0 +1,3 @@ +#define foo foo +#define bar foo +bar diff --git a/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected new file mode 100644 index 00000000000..ad955fce6ec --- /dev/null +++ b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected @@ -0,0 +1,4 @@ + + +foo + diff --git a/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c new file mode 100644 index 00000000000..b433671d1bf --- /dev/null +++ b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo bar diff --git a/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected new file mode 100644 index 00000000000..960f44511a9 --- /dev/null +++ b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected @@ -0,0 +1,3 @@ + +foo bar + diff --git a/src/glsl/glcpp/tests/026-define-func-extra-newlines.c b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c new file mode 100644 index 00000000000..0d837405309 --- /dev/null +++ b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c @@ -0,0 +1,6 @@ +#define foo(a) bar + +foo +( +1 +) diff --git a/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected new file mode 100644 index 00000000000..f0888f21b94 --- /dev/null +++ b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected @@ -0,0 +1,4 @@ + + +bar + diff --git a/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c new file mode 100644 index 00000000000..5ccb52caba5 --- /dev/null +++ b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c @@ -0,0 +1,3 @@ +#define failure() success +#define foo failure() +foo diff --git a/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected new file mode 100644 index 00000000000..aef762e1e69 --- /dev/null +++ b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c new file mode 100644 index 00000000000..44962a71876 --- /dev/null +++ b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c @@ -0,0 +1,3 @@ +#define success() failure +#define foo success +foo diff --git a/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected new file mode 100644 index 00000000000..aef762e1e69 --- /dev/null +++ b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c new file mode 100644 index 00000000000..261f7d28fc2 --- /dev/null +++ b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c @@ -0,0 +1,3 @@ +#define bar(failure) failure +#define foo bar(success) +foo diff --git a/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected new file mode 100644 index 00000000000..aef762e1e69 --- /dev/null +++ b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c new file mode 100644 index 00000000000..e56fbefd62d --- /dev/null +++ b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c @@ -0,0 +1,4 @@ +#define baz(failure) failure +#define bar(failure) failure +#define foo bar(baz(success)) +foo diff --git a/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected new file mode 100644 index 00000000000..729bdd15f80 --- /dev/null +++ b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c new file mode 100644 index 00000000000..3f4c8744dff --- /dev/null +++ b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c @@ -0,0 +1,4 @@ +#define baz(failure) failure +#define bar(failure) failure +#define foo() bar(baz(success)) +foo() diff --git a/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected new file mode 100644 index 00000000000..729bdd15f80 --- /dev/null +++ b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/032-define-func-self-recurse.c b/src/glsl/glcpp/tests/032-define-func-self-recurse.c new file mode 100644 index 00000000000..b3ac70f499c --- /dev/null +++ b/src/glsl/glcpp/tests/032-define-func-self-recurse.c @@ -0,0 +1,2 @@ +#define foo(a) foo(2*(a)) +foo(3) diff --git a/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected b/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected new file mode 100644 index 00000000000..541d44db7ab --- /dev/null +++ b/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected @@ -0,0 +1,3 @@ + +foo(2*(3)) + diff --git a/src/glsl/glcpp/tests/033-define-func-self-compose.c b/src/glsl/glcpp/tests/033-define-func-self-compose.c new file mode 100644 index 00000000000..f65e48286cf --- /dev/null +++ b/src/glsl/glcpp/tests/033-define-func-self-compose.c @@ -0,0 +1,2 @@ +#define foo(a) foo(2*(a)) +foo(foo(3)) diff --git a/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected b/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected new file mode 100644 index 00000000000..6ea6905d80b --- /dev/null +++ b/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected @@ -0,0 +1,3 @@ + +foo(2*(foo(2*(3)))) + diff --git a/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c new file mode 100644 index 00000000000..209a5f7e07c --- /dev/null +++ b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo(foo) diff --git a/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected new file mode 100644 index 00000000000..24823b1b673 --- /dev/null +++ b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected @@ -0,0 +1,3 @@ + +foo + diff --git a/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c new file mode 100644 index 00000000000..c307fbe830f --- /dev/null +++ b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo(1+foo) diff --git a/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected new file mode 100644 index 00000000000..137a9ea2db8 --- /dev/null +++ b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected @@ -0,0 +1,3 @@ + +1+foo + diff --git a/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c new file mode 100644 index 00000000000..b21ff336738 --- /dev/null +++ b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c @@ -0,0 +1,3 @@ +#define bar success +#define foo(x) x +foo(more bar) diff --git a/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected new file mode 100644 index 00000000000..ff6360bfe4e --- /dev/null +++ b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected @@ -0,0 +1,4 @@ + + +more success + diff --git a/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c new file mode 100644 index 00000000000..b3a2f37f1b9 --- /dev/null +++ b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c @@ -0,0 +1,3 @@ +#define expand(x) expand(x once) +#define foo(x) x +foo(expand(just)) diff --git a/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected new file mode 100644 index 00000000000..cbadee848a5 --- /dev/null +++ b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected @@ -0,0 +1,4 @@ + + +expand(just once) + diff --git a/src/glsl/glcpp/tests/038-func-arg-with-commas.c b/src/glsl/glcpp/tests/038-func-arg-with-commas.c new file mode 100644 index 00000000000..1407c7d6e3c --- /dev/null +++ b/src/glsl/glcpp/tests/038-func-arg-with-commas.c @@ -0,0 +1,2 @@ +#define foo(x) success +foo(argument (with,embedded , commas) -- tricky) diff --git a/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected b/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected new file mode 100644 index 00000000000..5a28fb3b66c --- /dev/null +++ b/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected @@ -0,0 +1,3 @@ + +success + diff --git a/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c new file mode 100644 index 00000000000..0f7fe632b56 --- /dev/null +++ b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c @@ -0,0 +1,3 @@ +#define foo(a) (a) +#define bar two,words +foo(bar) diff --git a/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected new file mode 100644 index 00000000000..b73869d0238 --- /dev/null +++ b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected @@ -0,0 +1,4 @@ + + +(two,words) + diff --git a/src/glsl/glcpp/tests/040-token-pasting.c b/src/glsl/glcpp/tests/040-token-pasting.c new file mode 100644 index 00000000000..caab3ba7368 --- /dev/null +++ b/src/glsl/glcpp/tests/040-token-pasting.c @@ -0,0 +1,2 @@ +#define paste(a,b) a ## b +paste(one , token) diff --git a/src/glsl/glcpp/tests/040-token-pasting.c.expected b/src/glsl/glcpp/tests/040-token-pasting.c.expected new file mode 100644 index 00000000000..36f66992539 --- /dev/null +++ b/src/glsl/glcpp/tests/040-token-pasting.c.expected @@ -0,0 +1,3 @@ + +onetoken + diff --git a/src/glsl/glcpp/tests/041-if-0.c b/src/glsl/glcpp/tests/041-if-0.c new file mode 100644 index 00000000000..2cab677d3e8 --- /dev/null +++ b/src/glsl/glcpp/tests/041-if-0.c @@ -0,0 +1,5 @@ +success_1 +#if 0 +failure +#endif +success_2 diff --git a/src/glsl/glcpp/tests/041-if-0.c.expected b/src/glsl/glcpp/tests/041-if-0.c.expected new file mode 100644 index 00000000000..3800024c6ff --- /dev/null +++ b/src/glsl/glcpp/tests/041-if-0.c.expected @@ -0,0 +1,6 @@ +success_1 + + + +success_2 + diff --git a/src/glsl/glcpp/tests/042-if-1.c b/src/glsl/glcpp/tests/042-if-1.c new file mode 100644 index 00000000000..874a25cf41b --- /dev/null +++ b/src/glsl/glcpp/tests/042-if-1.c @@ -0,0 +1,5 @@ +success_1 +#if 1 +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/042-if-1.c.expected b/src/glsl/glcpp/tests/042-if-1.c.expected new file mode 100644 index 00000000000..e591044adbb --- /dev/null +++ b/src/glsl/glcpp/tests/042-if-1.c.expected @@ -0,0 +1,6 @@ +success_1 + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/043-if-0-else.c b/src/glsl/glcpp/tests/043-if-0-else.c new file mode 100644 index 00000000000..323351f9dbf --- /dev/null +++ b/src/glsl/glcpp/tests/043-if-0-else.c @@ -0,0 +1,7 @@ +success_1 +#if 0 +failure +#else +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/043-if-0-else.c.expected b/src/glsl/glcpp/tests/043-if-0-else.c.expected new file mode 100644 index 00000000000..ee9e677096e --- /dev/null +++ b/src/glsl/glcpp/tests/043-if-0-else.c.expected @@ -0,0 +1,8 @@ +success_1 + + + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/044-if-1-else.c b/src/glsl/glcpp/tests/044-if-1-else.c new file mode 100644 index 00000000000..28dfc25c6f0 --- /dev/null +++ b/src/glsl/glcpp/tests/044-if-1-else.c @@ -0,0 +1,7 @@ +success_1 +#if 1 +success_2 +#else +failure +#endif +success_3 diff --git a/src/glsl/glcpp/tests/044-if-1-else.c.expected b/src/glsl/glcpp/tests/044-if-1-else.c.expected new file mode 100644 index 00000000000..129f5c8542e --- /dev/null +++ b/src/glsl/glcpp/tests/044-if-1-else.c.expected @@ -0,0 +1,8 @@ +success_1 + +success_2 + + + +success_3 + diff --git a/src/glsl/glcpp/tests/045-if-0-elif.c b/src/glsl/glcpp/tests/045-if-0-elif.c new file mode 100644 index 00000000000..e50f686d461 --- /dev/null +++ b/src/glsl/glcpp/tests/045-if-0-elif.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#elif 0 +failure_2 +#elif 1 +success_3 +#elif 1 +failure_3 +#endif +success_4 diff --git a/src/glsl/glcpp/tests/045-if-0-elif.c.expected b/src/glsl/glcpp/tests/045-if-0-elif.c.expected new file mode 100644 index 00000000000..97a11b4472e --- /dev/null +++ b/src/glsl/glcpp/tests/045-if-0-elif.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + +success_3 + + + +success_4 + diff --git a/src/glsl/glcpp/tests/046-if-1-elsif.c b/src/glsl/glcpp/tests/046-if-1-elsif.c new file mode 100644 index 00000000000..130515a01ea --- /dev/null +++ b/src/glsl/glcpp/tests/046-if-1-elsif.c @@ -0,0 +1,11 @@ +success_1 +#if 1 +success_2 +#elif 0 +failure_1 +#elif 1 +failure_2 +#elif 0 +failure_3 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/046-if-1-elsif.c.expected b/src/glsl/glcpp/tests/046-if-1-elsif.c.expected new file mode 100644 index 00000000000..b928b917e3d --- /dev/null +++ b/src/glsl/glcpp/tests/046-if-1-elsif.c.expected @@ -0,0 +1,12 @@ +success_1 + +success_2 + + + + + + + +success_3 + diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c b/src/glsl/glcpp/tests/047-if-elif-else.c new file mode 100644 index 00000000000..e8f0838a9ed --- /dev/null +++ b/src/glsl/glcpp/tests/047-if-elif-else.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#elif 0 +failure_2 +#elif 0 +failure_3 +#else +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c.expected b/src/glsl/glcpp/tests/047-if-elif-else.c.expected new file mode 100644 index 00000000000..e5b53a3fa59 --- /dev/null +++ b/src/glsl/glcpp/tests/047-if-elif-else.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + + + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/048-if-nested.c b/src/glsl/glcpp/tests/048-if-nested.c new file mode 100644 index 00000000000..fc4679c3be4 --- /dev/null +++ b/src/glsl/glcpp/tests/048-if-nested.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#if 1 +failure_2 +#else +failure_3 +#endif +failure_4 +#endif +success_2 diff --git a/src/glsl/glcpp/tests/048-if-nested.c.expected b/src/glsl/glcpp/tests/048-if-nested.c.expected new file mode 100644 index 00000000000..c61fd0b3159 --- /dev/null +++ b/src/glsl/glcpp/tests/048-if-nested.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + + + + + +success_2 + diff --git a/src/glsl/glcpp/tests/049-if-expression-precedence.c b/src/glsl/glcpp/tests/049-if-expression-precedence.c new file mode 100644 index 00000000000..833ea03882a --- /dev/null +++ b/src/glsl/glcpp/tests/049-if-expression-precedence.c @@ -0,0 +1,5 @@ +#if 1 + 2 * 3 + - (25 % 17 - + 1) +failure with operator precedence +#else +success +#endif diff --git a/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected b/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected new file mode 100644 index 00000000000..569debb0bb6 --- /dev/null +++ b/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected @@ -0,0 +1,6 @@ + + + +success + + diff --git a/src/glsl/glcpp/tests/050-if-defined.c b/src/glsl/glcpp/tests/050-if-defined.c new file mode 100644 index 00000000000..34f0f95140e --- /dev/null +++ b/src/glsl/glcpp/tests/050-if-defined.c @@ -0,0 +1,17 @@ +#if defined foo +failure_1 +#else +success_1 +#endif +#define foo +#if defined foo +success_2 +#else +failure_2 +#endif +#undef foo +#if defined foo +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/050-if-defined.c.expected b/src/glsl/glcpp/tests/050-if-defined.c.expected new file mode 100644 index 00000000000..3f01955ee40 --- /dev/null +++ b/src/glsl/glcpp/tests/050-if-defined.c.expected @@ -0,0 +1,18 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/051-if-relational.c b/src/glsl/glcpp/tests/051-if-relational.c new file mode 100644 index 00000000000..c3db488e0de --- /dev/null +++ b/src/glsl/glcpp/tests/051-if-relational.c @@ -0,0 +1,35 @@ +#if 3 < 2 +failure_1 +#else +success_1 +#endif + +#if 3 >= 2 +success_2 +#else +failure_2 +#endif + +#if 2 + 3 <= 5 +success_3 +#else +failure_3 +#endif + +#if 3 - 2 == 1 +success_3 +#else +failure_3 +#endif + +#if 1 > 3 +failure_4 +#else +success_4 +#endif + +#if 1 != 5 +success_5 +#else +failure_5 +#endif diff --git a/src/glsl/glcpp/tests/051-if-relational.c.expected b/src/glsl/glcpp/tests/051-if-relational.c.expected new file mode 100644 index 00000000000..d2b76f14576 --- /dev/null +++ b/src/glsl/glcpp/tests/051-if-relational.c.expected @@ -0,0 +1,36 @@ + + + +success_1 + + + +success_2 + + + + + +success_3 + + + + + +success_3 + + + + + + + +success_4 + + + +success_5 + + + + diff --git a/src/glsl/glcpp/tests/052-if-bitwise.c b/src/glsl/glcpp/tests/052-if-bitwise.c new file mode 100644 index 00000000000..2d8e45eb61e --- /dev/null +++ b/src/glsl/glcpp/tests/052-if-bitwise.c @@ -0,0 +1,20 @@ +#if (0xaaaaaaaa | 0x55555555) != 4294967295 +failure_1 +#else +success_1 +#endif +#if (0x12345678 ^ 0xfdecba98) == 4023971040 +success_2 +#else +failure_2 +#endif +#if (~ 0xdeadbeef) != -3735928560 +failure_3 +#else +success_3 +#endif +#if (0667 & 0733) == 403 +success_4 +#else +failure_4 +#endif diff --git a/src/glsl/glcpp/tests/052-if-bitwise.c.expected b/src/glsl/glcpp/tests/052-if-bitwise.c.expected new file mode 100644 index 00000000000..bb5d92e8d92 --- /dev/null +++ b/src/glsl/glcpp/tests/052-if-bitwise.c.expected @@ -0,0 +1,21 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + +success_4 + + + + diff --git a/src/glsl/glcpp/tests/053-if-divide-and-shift.c b/src/glsl/glcpp/tests/053-if-divide-and-shift.c new file mode 100644 index 00000000000..d24c54a88d1 --- /dev/null +++ b/src/glsl/glcpp/tests/053-if-divide-and-shift.c @@ -0,0 +1,15 @@ +#if (15 / 2) != 7 +failure_1 +#else +success_1 +#endif +#if (1 << 12) == 4096 +success_2 +#else +failure_2 +#endif +#if (31762 >> 8) != 124 +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected b/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected new file mode 100644 index 00000000000..f97e93673cc --- /dev/null +++ b/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected @@ -0,0 +1,16 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/054-if-with-macros.c b/src/glsl/glcpp/tests/054-if-with-macros.c new file mode 100644 index 00000000000..3da79a0d96e --- /dev/null +++ b/src/glsl/glcpp/tests/054-if-with-macros.c @@ -0,0 +1,34 @@ +#define one 1 +#define two 2 +#define three 3 +#define five 5 +#if five < two +failure_1 +#else +success_1 +#endif +#if three >= two +success_2 +#else +failure_2 +#endif +#if two + three <= five +success_3 +#else +failure_3 +#endif +#if five - two == three +success_4 +#else +failure_4 +#endif +#if one > three +failure_5 +#else +success_5 +#endif +#if one != five +success_6 +#else +failure_6 +#endif diff --git a/src/glsl/glcpp/tests/054-if-with-macros.c.expected b/src/glsl/glcpp/tests/054-if-with-macros.c.expected new file mode 100644 index 00000000000..27ea4969628 --- /dev/null +++ b/src/glsl/glcpp/tests/054-if-with-macros.c.expected @@ -0,0 +1,35 @@ + + + + + + + +success_1 + + +success_2 + + + + +success_3 + + + + +success_4 + + + + + + +success_5 + + +success_6 + + + + diff --git a/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c new file mode 100644 index 00000000000..00f2c2346d6 --- /dev/null +++ b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c @@ -0,0 +1,3 @@ +#define failure() success +#define foo failure +foo() diff --git a/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected new file mode 100644 index 00000000000..aef762e1e69 --- /dev/null +++ b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/056-macro-argument-with-comma.c b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c new file mode 100644 index 00000000000..58701d1f25b --- /dev/null +++ b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c @@ -0,0 +1,4 @@ +#define bar with,embedded,commas +#define function(x) success +#define foo function +foo(bar) diff --git a/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected new file mode 100644 index 00000000000..729bdd15f80 --- /dev/null +++ b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/057-empty-arguments.c b/src/glsl/glcpp/tests/057-empty-arguments.c new file mode 100644 index 00000000000..6140232865d --- /dev/null +++ b/src/glsl/glcpp/tests/057-empty-arguments.c @@ -0,0 +1,6 @@ +#define zero() success +zero() +#define one(x) success +one() +#define two(x,y) success +two(,) diff --git a/src/glsl/glcpp/tests/057-empty-arguments.c.expected b/src/glsl/glcpp/tests/057-empty-arguments.c.expected new file mode 100644 index 00000000000..4e3aad52173 --- /dev/null +++ b/src/glsl/glcpp/tests/057-empty-arguments.c.expected @@ -0,0 +1,7 @@ + +success + +success + +success + diff --git a/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c new file mode 100644 index 00000000000..8ac260c76b6 --- /dev/null +++ b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c @@ -0,0 +1,5 @@ +#define paste(x,y) x ## y +paste(a,b) +paste(a,) +paste(,b) +paste(,) diff --git a/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected new file mode 100644 index 00000000000..a1c34e5c1f8 --- /dev/null +++ b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected @@ -0,0 +1,6 @@ + +ab +a +b + + diff --git a/src/glsl/glcpp/tests/059-token-pasting-integer.c b/src/glsl/glcpp/tests/059-token-pasting-integer.c new file mode 100644 index 00000000000..37b895a4237 --- /dev/null +++ b/src/glsl/glcpp/tests/059-token-pasting-integer.c @@ -0,0 +1,4 @@ +#define paste(x,y) x ## y +paste(1,2) +paste(1,000) +paste(identifier,2) diff --git a/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected b/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected new file mode 100644 index 00000000000..f1a2cd21c13 --- /dev/null +++ b/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected @@ -0,0 +1,5 @@ + +12 +1000 +identifier2 + diff --git a/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c new file mode 100644 index 00000000000..ed80ea879ce --- /dev/null +++ b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c @@ -0,0 +1,3 @@ +#define double(a) a*2 +#define foo double( +foo 5) diff --git a/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected new file mode 100644 index 00000000000..c1f0d24a144 --- /dev/null +++ b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected @@ -0,0 +1,4 @@ + + +5*2 + diff --git a/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c new file mode 100644 index 00000000000..6dbfd1f62d1 --- /dev/null +++ b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c @@ -0,0 +1,5 @@ +#define foo(x) success +#define bar foo +#define baz bar +#define joe baz +joe (failure) diff --git a/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected new file mode 100644 index 00000000000..111f7d10634 --- /dev/null +++ b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected @@ -0,0 +1,6 @@ + + + + +success + diff --git a/src/glsl/glcpp/tests/062-if-0-skips-garbage.c b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c new file mode 100644 index 00000000000..d9e439bb890 --- /dev/null +++ b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c @@ -0,0 +1,5 @@ +#define foo(a,b) +#if 0 +foo(bar) +foo( +#endif diff --git a/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected new file mode 100644 index 00000000000..6fb66a5e2f0 --- /dev/null +++ b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/063-comments.c b/src/glsl/glcpp/tests/063-comments.c new file mode 100644 index 00000000000..e641d2f0f9e --- /dev/null +++ b/src/glsl/glcpp/tests/063-comments.c @@ -0,0 +1,20 @@ +/* this is a comment */ +// so is this +// */ +f = g/**//h; +/*//*/l(); +m = n//**/o ++ p; +/* this +comment spans +multiple lines and +contains *** stars +and slashes / *** / +and other stuff. +****/ +more code here +/* Test that /* nested + comments */ +are not treated like comments. +/*/ this is a comment */ +/*/*/ diff --git a/src/glsl/glcpp/tests/063-comments.c.expected b/src/glsl/glcpp/tests/063-comments.c.expected new file mode 100644 index 00000000000..ed4feedd457 --- /dev/null +++ b/src/glsl/glcpp/tests/063-comments.c.expected @@ -0,0 +1,14 @@ + + + +f = g /h; + l(); +m = n ++ p; + +more code here + +are not treated like comments. + + + diff --git a/src/glsl/glcpp/tests/064-version.c b/src/glsl/glcpp/tests/064-version.c new file mode 100644 index 00000000000..21326481b87 --- /dev/null +++ b/src/glsl/glcpp/tests/064-version.c @@ -0,0 +1,2 @@ +#version 130 +#define FOO diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected new file mode 100644 index 00000000000..1c534672705 --- /dev/null +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -0,0 +1,4 @@ +#version 130 + + + diff --git a/src/glsl/glcpp/tests/065-if-defined-parens.c b/src/glsl/glcpp/tests/065-if-defined-parens.c new file mode 100644 index 00000000000..48aa0f8c3ef --- /dev/null +++ b/src/glsl/glcpp/tests/065-if-defined-parens.c @@ -0,0 +1,17 @@ +#if defined(foo) +failure_1 +#else +success_1 +#endif +#define foo +#if defined ( foo ) +success_2 +#else +failure_2 +#endif +#undef foo +#if defined (foo) +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/065-if-defined-parens.c.expected b/src/glsl/glcpp/tests/065-if-defined-parens.c.expected new file mode 100644 index 00000000000..3f01955ee40 --- /dev/null +++ b/src/glsl/glcpp/tests/065-if-defined-parens.c.expected @@ -0,0 +1,18 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c b/src/glsl/glcpp/tests/066-if-nospace-expression.c new file mode 100644 index 00000000000..3b0b47349d0 --- /dev/null +++ b/src/glsl/glcpp/tests/066-if-nospace-expression.c @@ -0,0 +1,3 @@ +#if(1) +success +#endif diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected new file mode 100644 index 00000000000..0e84a7cda39 --- /dev/null +++ b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected @@ -0,0 +1,4 @@ + +success + + diff --git a/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c new file mode 100644 index 00000000000..f46cce4e60a --- /dev/null +++ b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c @@ -0,0 +1,40 @@ +#define D1 +#define D2 + +#define result success + +#ifdef U1 +#ifdef U2 +#undef result +#define result failure +#endif +#endif +result + +#ifndef D1 +#ifndef D2 +#undef result +#define result failure +#endif +#endif +result + +#undef result +#define result failure +#ifdef D1 +#ifdef D2 +#undef result +#define result success +#endif +#endif +result + +#undef result +#define result failure +#ifndef U1 +#ifndef U2 +#undef result +#define result success +#endif +#endif +result diff --git a/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected new file mode 100644 index 00000000000..3340daaa1f9 --- /dev/null +++ b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected @@ -0,0 +1,41 @@ + + + + + + + + + + + +success + + + + + + + +success + + + + + + + + + +success + + + + + + + + + +success + diff --git a/src/glsl/glcpp/tests/068-accidental-pasting.c b/src/glsl/glcpp/tests/068-accidental-pasting.c new file mode 100644 index 00000000000..699ac5144e5 --- /dev/null +++ b/src/glsl/glcpp/tests/068-accidental-pasting.c @@ -0,0 +1,11 @@ +#define empty +<empty< +<empty= +>empty> +>empty= +=empty= +!empty= +&empty& +|empty| ++empty+ +-empty- diff --git a/src/glsl/glcpp/tests/068-accidental-pasting.c.expected b/src/glsl/glcpp/tests/068-accidental-pasting.c.expected new file mode 100644 index 00000000000..ce41cd6e524 --- /dev/null +++ b/src/glsl/glcpp/tests/068-accidental-pasting.c.expected @@ -0,0 +1,12 @@ + +< < +< = +> > +> = += = +! = +& & +| | ++ + +- - + diff --git a/src/glsl/glcpp/tests/069-repeated-argument.c b/src/glsl/glcpp/tests/069-repeated-argument.c new file mode 100644 index 00000000000..2b46ead294c --- /dev/null +++ b/src/glsl/glcpp/tests/069-repeated-argument.c @@ -0,0 +1,2 @@ +#define double(x) x x +double(1) diff --git a/src/glsl/glcpp/tests/069-repeated-argument.c.expected b/src/glsl/glcpp/tests/069-repeated-argument.c.expected new file mode 100644 index 00000000000..755c4d4b56c --- /dev/null +++ b/src/glsl/glcpp/tests/069-repeated-argument.c.expected @@ -0,0 +1,3 @@ + +1 1 + diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c new file mode 100644 index 00000000000..b6dc2ba075f --- /dev/null +++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c @@ -0,0 +1,2 @@ +#if UNDEFINED_MACRO +#endif diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected new file mode 100644 index 00000000000..2bb38a1411e --- /dev/null +++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected @@ -0,0 +1,2 @@ +0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER + diff --git a/src/glsl/glcpp/tests/071-punctuator.c b/src/glsl/glcpp/tests/071-punctuator.c new file mode 100644 index 00000000000..959d6825988 --- /dev/null +++ b/src/glsl/glcpp/tests/071-punctuator.c @@ -0,0 +1 @@ +a = b diff --git a/src/glsl/glcpp/tests/071-punctuator.c.expected b/src/glsl/glcpp/tests/071-punctuator.c.expected new file mode 100644 index 00000000000..fee253b7452 --- /dev/null +++ b/src/glsl/glcpp/tests/071-punctuator.c.expected @@ -0,0 +1,2 @@ +a = b + diff --git a/src/glsl/glcpp/tests/072-token-pasting-same-line.c b/src/glsl/glcpp/tests/072-token-pasting-same-line.c new file mode 100644 index 00000000000..e421e9d5e29 --- /dev/null +++ b/src/glsl/glcpp/tests/072-token-pasting-same-line.c @@ -0,0 +1,2 @@ +#define paste(x) success_ ## x +paste(1) paste(2) paste(3) diff --git a/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected b/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected new file mode 100644 index 00000000000..c780b43d70f --- /dev/null +++ b/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected @@ -0,0 +1,3 @@ + +success_1 success_2 success_3 + diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c b/src/glsl/glcpp/tests/073-if-in-ifdef.c new file mode 100644 index 00000000000..61a48097ca3 --- /dev/null +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c @@ -0,0 +1,4 @@ +#ifdef UNDEF +#if UNDEF > 1 +#endif +#endif diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected b/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected new file mode 100644 index 00000000000..3f2ff2d6cc8 --- /dev/null +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected @@ -0,0 +1,5 @@ + + + + + diff --git a/src/glsl/glcpp/tests/074-elif-undef.c b/src/glsl/glcpp/tests/074-elif-undef.c new file mode 100644 index 00000000000..67aac8977e0 --- /dev/null +++ b/src/glsl/glcpp/tests/074-elif-undef.c @@ -0,0 +1,3 @@ +#ifndef UNDEF +#elif UNDEF < 0 +#endif diff --git a/src/glsl/glcpp/tests/074-elif-undef.c.expected b/src/glsl/glcpp/tests/074-elif-undef.c.expected new file mode 100644 index 00000000000..fd40910d9e7 --- /dev/null +++ b/src/glsl/glcpp/tests/074-elif-undef.c.expected @@ -0,0 +1,4 @@ + + + + diff --git a/src/glsl/glcpp/tests/075-elif-elif-undef.c b/src/glsl/glcpp/tests/075-elif-elif-undef.c new file mode 100644 index 00000000000..264bc4f10ee --- /dev/null +++ b/src/glsl/glcpp/tests/075-elif-elif-undef.c @@ -0,0 +1,4 @@ +#ifndef UNDEF +#elif UNDEF < 0 +#elif UNDEF == 3 +#endif diff --git a/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected b/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected new file mode 100644 index 00000000000..3f2ff2d6cc8 --- /dev/null +++ b/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected @@ -0,0 +1,5 @@ + + + + + diff --git a/src/glsl/glcpp/tests/076-elif-undef-nested.c b/src/glsl/glcpp/tests/076-elif-undef-nested.c new file mode 100644 index 00000000000..ebd550ed005 --- /dev/null +++ b/src/glsl/glcpp/tests/076-elif-undef-nested.c @@ -0,0 +1,5 @@ +#ifdef UNDEF +#if UNDEF == 4 +#elif UNDEF == 5 +#endif +#endif diff --git a/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected b/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected new file mode 100644 index 00000000000..6fb66a5e2f0 --- /dev/null +++ b/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/077-else-without-if.c b/src/glsl/glcpp/tests/077-else-without-if.c new file mode 100644 index 00000000000..81f00bfe278 --- /dev/null +++ b/src/glsl/glcpp/tests/077-else-without-if.c @@ -0,0 +1 @@ +#else diff --git a/src/glsl/glcpp/tests/077-else-without-if.c.expected b/src/glsl/glcpp/tests/077-else-without-if.c.expected new file mode 100644 index 00000000000..d289b363562 --- /dev/null +++ b/src/glsl/glcpp/tests/077-else-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: else without #if + + + diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c b/src/glsl/glcpp/tests/078-elif-without-if.c new file mode 100644 index 00000000000..60466b3890a --- /dev/null +++ b/src/glsl/glcpp/tests/078-elif-without-if.c @@ -0,0 +1 @@ +#elif defined FOO diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c.expected b/src/glsl/glcpp/tests/078-elif-without-if.c.expected new file mode 100644 index 00000000000..7d41f0ac794 --- /dev/null +++ b/src/glsl/glcpp/tests/078-elif-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: elif without #if + + + diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c b/src/glsl/glcpp/tests/079-endif-without-if.c new file mode 100644 index 00000000000..69331c3ca9d --- /dev/null +++ b/src/glsl/glcpp/tests/079-endif-without-if.c @@ -0,0 +1 @@ +#endif diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c.expected b/src/glsl/glcpp/tests/079-endif-without-if.c.expected new file mode 100644 index 00000000000..08dd33546f2 --- /dev/null +++ b/src/glsl/glcpp/tests/079-endif-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: #endif without #if + + + diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c b/src/glsl/glcpp/tests/080-if-without-expression.c new file mode 100644 index 00000000000..a27ba36a366 --- /dev/null +++ b/src/glsl/glcpp/tests/080-if-without-expression.c @@ -0,0 +1,4 @@ +/* Error message for unskipped #if with no expression. */ +#if +#endif + diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/glsl/glcpp/tests/080-if-without-expression.c.expected new file mode 100644 index 00000000000..768ba0f473f --- /dev/null +++ b/src/glsl/glcpp/tests/080-if-without-expression.c.expected @@ -0,0 +1,6 @@ +0:2(1): preprocessor error: #if with no expression + + + + + diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c b/src/glsl/glcpp/tests/081-elif-without-expression.c new file mode 100644 index 00000000000..79c78663dd3 --- /dev/null +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c @@ -0,0 +1,3 @@ +#if 0 +#elif +#endif diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected new file mode 100644 index 00000000000..974f0f550eb --- /dev/null +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected @@ -0,0 +1,5 @@ +0:2(1): preprocessor error: #elif with no expression + + + + diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c b/src/glsl/glcpp/tests/082-invalid-paste.c new file mode 100644 index 00000000000..40bf64411c5 --- /dev/null +++ b/src/glsl/glcpp/tests/082-invalid-paste.c @@ -0,0 +1,2 @@ +#define PASTE(x,y) x ## y +PASTE(<,>) diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c.expected b/src/glsl/glcpp/tests/082-invalid-paste.c.expected new file mode 100644 index 00000000000..2c924406b59 --- /dev/null +++ b/src/glsl/glcpp/tests/082-invalid-paste.c.expected @@ -0,0 +1,5 @@ +0:2(7): preprocessor error: +Pasting "<" and ">" does not give a valid preprocessing token. + +< + diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c b/src/glsl/glcpp/tests/083-unterminated-if.c new file mode 100644 index 00000000000..91806350927 --- /dev/null +++ b/src/glsl/glcpp/tests/083-unterminated-if.c @@ -0,0 +1,2 @@ +#if 1 + diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c.expected b/src/glsl/glcpp/tests/083-unterminated-if.c.expected new file mode 100644 index 00000000000..a69f8bab582 --- /dev/null +++ b/src/glsl/glcpp/tests/083-unterminated-if.c.expected @@ -0,0 +1,5 @@ +0:1(7): preprocessor error: Unterminated #if + + + + diff --git a/src/glsl/glcpp/tests/084-unbalanced-parentheses.c b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c new file mode 100644 index 00000000000..0789ba5e525 --- /dev/null +++ b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c @@ -0,0 +1,2 @@ +#define FUNC(x) (2*(x)) +FUNC(23 diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c b/src/glsl/glcpp/tests/085-incorrect-argument-count.c new file mode 100644 index 00000000000..91bea600612 --- /dev/null +++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c @@ -0,0 +1,5 @@ +#define MULT(x,y) ((x)*(y)) +MULT() +MULT(1) +MULT(1,2,3) + diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected new file mode 100644 index 00000000000..1df30cbb56f --- /dev/null +++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected @@ -0,0 +1,12 @@ +0:2(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2) + +0:3(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2) + +0:4(1): preprocessor error: Error: macro MULT invoked with 3 arguments (expected 2) + + +MULT() +MULT(1) +MULT(1,2,3) + + diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c b/src/glsl/glcpp/tests/086-reserved-macro-names.c new file mode 100644 index 00000000000..fd0c29f0c47 --- /dev/null +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c @@ -0,0 +1,2 @@ +#define __BAD reserved +#define GL_ALSO_BAD() also reserved diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected new file mode 100644 index 00000000000..6a9df682685 --- /dev/null +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected @@ -0,0 +1,7 @@ +0:1(10): preprocessor error: Macro names starting with "__" are reserved. + +0:2(9): preprocessor error: Macro names starting with "GL_" are reserved. + + + + diff --git a/src/glsl/glcpp/tests/099-c99-example.c b/src/glsl/glcpp/tests/099-c99-example.c new file mode 100644 index 00000000000..d1976b1f265 --- /dev/null +++ b/src/glsl/glcpp/tests/099-c99-example.c @@ -0,0 +1,17 @@ +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +#define p() int +#define q(x) x +#define r(x,y) x ## y +f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); +g(x +(3,4)-w) | h 5) & m + (f)^m(m); +p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,)}; diff --git a/src/glsl/glcpp/tests/099-c99-example.c.expected b/src/glsl/glcpp/tests/099-c99-example.c.expected new file mode 100644 index 00000000000..19be7505552 --- /dev/null +++ b/src/glsl/glcpp/tests/099-c99-example.c.expected @@ -0,0 +1,17 @@ + + + + + + + + + + + + + +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/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test new file mode 100755 index 00000000000..6494d0c0e77 --- /dev/null +++ b/src/glsl/glcpp/tests/glcpp-test @@ -0,0 +1,49 @@ +#!/bin/sh + +trap 'rm $test.valgrind-errors; exit 1' INT QUIT + +total=0 +pass=0 +clean=0 + +echo "====== Testing for correctness ======" +for test in *.c; do + echo -n "Testing $test..." + ../glcpp < $test > $test.out 2>&1 + total=$((total+1)) + if cmp $test.expected $test.out >/dev/null 2>&1; then + echo "PASS" + pass=$((pass+1)) + else + echo "FAIL" + diff -u $test.expected $test.out + fi +done + +echo "" +echo "$pass/$total tests returned correct results" +echo "" + +echo "====== Testing for valgrind cleanliness ======" +for test in *.c; do + echo -n "Testing $test with valgrind..." + if valgrind --error-exitcode=1 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null; then + echo "CLEAN" + clean=$((clean+1)) + rm $test.valgrind-errors + else + echo "ERRORS" + cat $test.valgrind-errors + fi +done + +echo "" +echo "$pass/$total tests returned correct results" +echo "$clean/$total tests are valgrind-clean" + +if [ "$pass" = "$total" ] && [ "$clean" = "$total" ]; then + exit 0 +else + exit 1 +fi + |