diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-12-21 00:36:12 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-12-21 02:32:06 -0500 |
commit | 494079ee46d67ae7ef6504734f7400b543c6d848 (patch) | |
tree | 9f4ad236fe10ef99b422913edc98d85cf83f99aa /tests | |
parent | 0eb3d602df451f882e107ebed47b3bce9a1e68dc (diff) | |
download | dimension-494079ee46d67ae7ef6504734f7400b543c6d848.tar.xz |
Support #declare, #local, and #undef.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dimension/directives.pov | 14 | ||||
-rwxr-xr-x | tests/dimension/directives.sh | 29 |
2 files changed, 37 insertions, 6 deletions
diff --git a/tests/dimension/directives.pov b/tests/dimension/directives.pov index 6907450..6b0e72c 100644 --- a/tests/dimension/directives.pov +++ b/tests/dimension/directives.pov @@ -19,6 +19,16 @@ // Test the language directives -#include "punctuation.pov" +#declare Center = 0; +#declare R = 1; +#local Color = rgb <1, 0, 1>; -#declare id +#declare Unused = -1; +#undef Unused + +sphere { + Center, R + pigment { + color Color + } +} diff --git a/tests/dimension/directives.sh b/tests/dimension/directives.sh index 75c2452..c64cbd8 100755 --- a/tests/dimension/directives.sh +++ b/tests/dimension/directives.sh @@ -19,11 +19,32 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -directives=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/directives.pov) -directives_exp='(#include (string "punctuation.pov") #declare (identifier "id"))'; +directives=$(${top_builddir}/dimension/dimension --tokenize --parse ${srcdir}/directives.pov) +directives_exp="$(echo -n \ +'(#declare (identifier "Center") = (integer "0") ; + #declare (identifier "R") = (integer "1") ; + #local (identifier "Color") = rgb < (integer "1") , (integer "0") , (integer "1") > ; + #declare (identifier "Unused") = - (integer "1") ; + #undef (identifier "Unused") + sphere { + (identifier "Center") , (identifier "R") + pigment { + color (identifier "Color") + } + })' \ +| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g') +$(echo -n \ +'((sphere + (vector (integer 0) (integer 0) (integer 0) (integer 0) (integer 0)) + (integer 1) + (object-modifiers + (texture + (pigment (vector (integer 1) (integer 0) (integer 1) + (integer 0) (integer 0)))))))' \ +| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')" if [ "$directives" != "$directives_exp" ]; then - echo "directives.pov tokenized as \"$directives\"" >&2 - echo " -- expected \"$directives_exp\"" >&2 + echo "directives.pov parsed as \"$directives\"" >&2 + echo " -- expected \"$directives_exp\"" >&2 exit 1 fi |