summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-25 02:04:15 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-25 02:04:15 -0500
commit7bbc14551b0513ec94bdac0eff0d64842fe55b2b (patch)
tree5372e3149a0d277531613b61296d99567f233f53
parent1d427193ffd38b85489b5e997faf72051305ec7a (diff)
downloaddimension-7bbc14551b0513ec94bdac0eff0d64842fe55b2b.tar.xz
Format S-expressions a bit nicer in test scripts.
-rwxr-xr-xtests/dimension/arithexp.sh18
-rwxr-xr-xtests/dimension/demo.sh24
-rwxr-xr-xtests/dimension/numeric.sh16
3 files changed, 53 insertions, 5 deletions
diff --git a/tests/dimension/arithexp.sh b/tests/dimension/arithexp.sh
index dc63576..24aebd8 100755
--- a/tests/dimension/arithexp.sh
+++ b/tests/dimension/arithexp.sh
@@ -20,8 +20,22 @@
#########################################################################
arithexp=$(${top_builddir}/dimension/dimension --tokenize --parse ${srcdir}/arithexp.pov)
-arithexp_exp='(sphere { < < (float "2.0") - (float "1.0") , (float "3.0") , (float "4.0") > . x , \( (float "1.0") + (integer "2") \) * (integer "2") - (integer "5") , (float "1.0") + (integer "2") * (integer "2") - (integer "4") > - - < (integer "0") , (integer "0") , (integer "1") > , (float "2.25") - (integer "1") * (integer "2") })
-((sphere (vector (float 0) (float 0) (float 0) (integer 0) (integer 0)) (float 0.25) object-modifiers))'
+arithexp_exp="$(echo -n \
+'(sphere {
+ < < (float "2.0") - (float "1.0") , (float "3.0") , (float "4.0") > . x ,
+ \( (float "1.0") + (integer "2") \) * (integer "2") - (integer "5") ,
+ (float "1.0") + (integer "2") * (integer "2") - (integer "4") >
+ -
+ - < (integer "0") , (integer "0") , (integer "1") > ,
+ (float "2.25") - (integer "1") * (integer "2")
+ })' \
+| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')
+$(echo -n \
+'((sphere
+ (vector (float 0) (float 0) (float 0) (integer 0) (integer 0))
+ (float 0.25)
+ object-modifiers))' \
+| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')"
if [ "$arithexp" != "$arithexp_exp" ]; then
echo "arithexp.pov parsed as \"$arithexp\"" >&2
diff --git a/tests/dimension/demo.sh b/tests/dimension/demo.sh
index da3548a..0e0303a 100755
--- a/tests/dimension/demo.sh
+++ b/tests/dimension/demo.sh
@@ -20,8 +20,28 @@
#########################################################################
demo=$(${top_builddir}/dimension/dimension --tokenize --parse ${srcdir}/demo.pov)
-demo_exp='(box { < - (integer "1") , - (integer "1") , - (integer "1") > , < (integer "1") , (integer "1") , (integer "1") > rotate < (integer "45") , (integer "0") , (integer "0") > } sphere { < (integer "0") , (integer "0") , (integer "0") > , (float "1.25") })
-((box (vector (integer -1) (integer -1) (integer -1) (integer 0) (integer 0)) (vector (integer 1) (integer 1) (integer 1) (integer 0) (integer 0)) (object-modifiers (rotate (vector (integer 45) (integer 0) (integer 0) (integer 0) (integer 0))))) (sphere (vector (integer 0) (integer 0) (integer 0) (integer 0) (integer 0)) (float 1.25) object-modifiers))'
+demo_exp="$(echo -n \
+'(box {
+ < - (integer "1") , - (integer "1") , - (integer "1") > ,
+ < (integer "1") , (integer "1") , (integer "1") >
+ rotate < (integer "45") , (integer "0") , (integer "0") >
+ }
+ sphere {
+ < (integer "0") , (integer "0") , (integer "0") > , (float "1.25")
+ })' \
+| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')
+$(echo -n \
+'((box
+ (vector (integer -1) (integer -1) (integer -1) (integer 0) (integer 0))
+ (vector (integer 1) (integer 1) (integer 1) (integer 0) (integer 0))
+ (object-modifiers
+ (rotate (vector (integer 45) (integer 0) (integer 0) (integer 0)
+ (integer 0)))))
+ (sphere
+ (vector (integer 0) (integer 0) (integer 0) (integer 0) (integer 0))
+ (float 1.25)
+ object-modifiers))' \
+| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')"
if [ "$demo" != "$demo_exp" ]; then
echo "demo.pov parsed as \"$demo\"" >&2
diff --git a/tests/dimension/numeric.sh b/tests/dimension/numeric.sh
index d4b4d89..50a4e65 100755
--- a/tests/dimension/numeric.sh
+++ b/tests/dimension/numeric.sh
@@ -20,7 +20,21 @@
#########################################################################
numeric=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/numeric.pov)
-numeric_exp='((integer "1") (integer "123456789") (integer "01234567") (integer "0x123456789") - (integer "0x01") (float ".1") (float "0.1") (float "1.0") (float "0.123456789") - (float "0.123456789") < (integer "1") , (float "2.2") , - (float "3.03") >)'
+numeric_exp=$(echo -n \
+'((integer "1")
+ (integer "123456789")
+ (integer "01234567")
+ (integer "0x123456789")
+ - (integer "0x01")
+
+ (float ".1")
+ (float "0.1")
+ (float "1.0")
+ (float "0.123456789")
+ - (float "0.123456789")
+
+ < (integer "1") , (float "2.2") , - (float "3.03") >)' \
+| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')
if [ "$numeric" != "$numeric_exp" ]; then
echo "numeric.pov tokenized as \"$numeric\"" >&2