From 58bd8b3b09a11ee2f698e21608ef71c65d97f804 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 3 Feb 2010 02:38:30 -0500 Subject: Implement #while. --- tests/dimension/directives.pov | 21 +++++++++++++-------- tests/dimension/directives.sh | 27 +++++++++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/dimension/directives.pov b/tests/dimension/directives.pov index 94e613f..c6ac07b 100644 --- a/tests/dimension/directives.pov +++ b/tests/dimension/directives.pov @@ -30,13 +30,18 @@ Illegal #end -#if (#if (1 = 1) 0 #end = 0 & 0) - `Illegal -#else - sphere { - Center, R - pigment { - color Color green 1 +#declare Counter = 0; +#while (Counter < 2) + #if (#if (1 = 1) 0 #end = 0 & 0) + `Illegal + #else + sphere { + Center + <0, Counter, 0>, R + pigment { + color Color green 1 + } } - } + #end + + #declare Counter = Counter + 1; #end diff --git a/tests/dimension/directives.sh b/tests/dimension/directives.sh index 198e25b..9152d2f 100755 --- a/tests/dimension/directives.sh +++ b/tests/dimension/directives.sh @@ -29,21 +29,32 @@ directives_exp="$(echo -n \ #ifdef \( (identifier "Unused") \) (identifier "Illegal") #end - #if \( #if \( (integer "1") = (integer "1") \) (integer "0") #end = (integer "0") & (integer "0") \) - error (identifier "Illegal") - #else - sphere { - (identifier "Center") , (identifier "R") - pigment { - color (identifier "Color") green (integer "1") + #declare (identifier "Counter") = (integer "0") ; + #while \( (identifier "Counter") < (integer "2") \) + #if \( #if \( (integer "1") = (integer "1") \) (integer "0") #end = (integer "0") & (integer "0") \) + error (identifier "Illegal") + #else + sphere { + (identifier "Center") + < (integer "0") , (identifier "Counter") , (integer "0") > , (identifier "R") + pigment { + color (identifier "Color") green (integer "1") + } } - } + #end + #declare (identifier "Counter") = (identifier "Counter") + (integer "1") ; #end)' \ | 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 (color (integer 1) (integer 1) (integer 1) + (integer 0) (integer 0)))))) + (sphere + (vector (integer 0) (integer 1) (integer 0) (integer 0) (integer 0)) + (integer 1) (object-modifiers (texture (pigment (color (integer 1) (integer 1) (integer 1) -- cgit v1.2.3