summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-03-23 17:35:53 -0400
committerTavian Barnes <tavianator@gmail.com>2010-03-23 17:48:37 -0400
commite51389d68ef2e152054d987d7a99930bce180954 (patch)
tree78a59584f7e640e0d077a5d887305e3b5fdba060 /tests
parent1d441aea4446484342f93fbf315f7f70de8adaf7 (diff)
downloaddimension-e51389d68ef2e152054d987d7a99930bce180954.tar.xz
Implement macro support.
Diffstat (limited to 'tests')
-rw-r--r--tests/dimension/directives.pov22
-rwxr-xr-xtests/dimension/directives.sh20
2 files changed, 28 insertions, 14 deletions
diff --git a/tests/dimension/directives.pov b/tests/dimension/directives.pov
index 416bbf5..e4721fc 100644
--- a/tests/dimension/directives.pov
+++ b/tests/dimension/directives.pov
@@ -40,18 +40,26 @@
#error "#undef failed"
#end
+#macro Make_Sphere(n)
+ sphere {
+ Center + <0, n, 0>, R
+ pigment {
+ color Color green 1
+ }
+ }
+#end
+
+#macro Inc(n)
+ #declare n = n + 1;
+#end
+
#declare Counter = 0;
#while (Counter < 2)
#if (#if (1 = 1) 0 #end = 0 & !1)
#error "Nested #if parsing failed"
#else
- sphere {
- Center + <0, Counter, 0>, R
- pigment {
- color Color green 1
- }
- }
+ Make_Sphere(Counter)
#end
- #declare Counter = Counter + 1;
+ Inc(Counter)
#end
diff --git a/tests/dimension/directives.sh b/tests/dimension/directives.sh
index 42815a6..713a1fe 100755
--- a/tests/dimension/directives.sh
+++ b/tests/dimension/directives.sh
@@ -35,19 +35,25 @@ directives_exp="$(echo -n \
#ifdef \( (identifier "Unused") \)
#error (string "#undef failed")
#end
+ #macro (identifier "Make_Sphere") \( (identifier "n") \)
+ sphere {
+ (identifier "Center") + < (integer "0") , (identifier "n") , (integer "0") > , (identifier "R")
+ pigment {
+ color (identifier "Color") green (integer "1")
+ }
+ }
+ #end
+ #macro (identifier "Inc") \( (identifier "n") \)
+ #declare (identifier "n") = (identifier "n") + (integer "1") ;
+ #end
#declare (identifier "Counter") = (integer "0") ;
#while \( (identifier "Counter") < (integer "2") \)
#if \( #if \( (integer "1") = (integer "1") \) (integer "0") #end = (integer "0") & ! (integer "1") \)
#error (string "Nested #if parsing failed")
#else
- sphere {
- (identifier "Center") + < (integer "0") , (identifier "Counter") , (integer "0") > , (identifier "R")
- pigment {
- color (identifier "Color") green (integer "1")
- }
- }
+ (identifier "Make_Sphere") \( (identifier "Counter") \)
#end
- #declare (identifier "Counter") = (identifier "Counter") + (integer "1") ;
+ (identifier "Inc") \( (identifier "Counter") \)
#end)' \
| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')
$(echo -n \