diff options
author | Carl Worth <cworth@cworth.org> | 2010-05-24 10:37:38 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-05-24 10:37:38 -0700 |
commit | bcbd587b0f5312d85307785ee2df6e5906af4f7b (patch) | |
tree | b44d1115168ddf3bb401c56a1938a6813718cbdc /tests | |
parent | b20d33c5c6fea8e392c26e9ab060efd14034f1f9 (diff) |
Implement all operators specified for GLSL #if expressions (with tests).
The operator coverage here is quite complete. The one big thing
missing is that we are not yet doing macro expansion in #if
lines. This makes the whole support fairly useless, so we plan to fix
that shortcoming right away.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/049-if-expression-precedence.c | 6 | ||||
-rw-r--r-- | tests/050-if-defined.c | 19 | ||||
-rw-r--r-- | tests/051-if-relational.c | 35 |
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/049-if-expression-precedence.c b/tests/049-if-expression-precedence.c new file mode 100644 index 0000000000..cea935220f --- /dev/null +++ b/tests/049-if-expression-precedence.c @@ -0,0 +1,6 @@ +#if 1 + 2 * 3 + - (25 % 17 - + 1) +failure with operator precedence +#else +success +#endif + diff --git a/tests/050-if-defined.c b/tests/050-if-defined.c new file mode 100644 index 0000000000..9838cc747d --- /dev/null +++ b/tests/050-if-defined.c @@ -0,0 +1,19 @@ +#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/tests/051-if-relational.c b/tests/051-if-relational.c new file mode 100644 index 0000000000..c3db488e0d --- /dev/null +++ b/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 |