From 494079ee46d67ae7ef6504734f7400b543c6d848 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 21 Dec 2009 00:36:12 -0500 Subject: Support #declare, #local, and #undef. --- tests/dimension/directives.pov | 14 ++++++++++++-- tests/dimension/directives.sh | 29 +++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'tests/dimension') 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 . # ######################################################################### -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 -- cgit v1.2.3