diff tests/0004/run-test.sh @ 48:a7aad4c50cb9

Factor out some common utilities and setup code into test-utils.sh, and source that file within each run-test file.
author mas01cr
date Tue, 18 Sep 2007 09:24:52 +0000
parents 538064755914
children cee75159c0bc
line wrap: on
line diff
--- a/tests/0004/run-test.sh	Mon Sep 17 16:12:12 2007 +0000
+++ b/tests/0004/run-test.sh	Tue Sep 18 09:24:52 2007 +0000
@@ -1,38 +1,20 @@
 #! /bin/sh
 
-floatstring() {
-  case $1 in
-    0)
-      printf "\x00\x00\x00\x00\x00\x00\x00\x00";;
-    0.5)
-      printf "\x00\x00\x00\x00\x00\x00\xe0\x3f";;
-    1)
-      printf "\x00\x00\x00\x00\x00\x00\xf0\x3f";;
-    *)
-      echo "bad arg to floatstring(): $1"
-      exit 1;;
-  esac
-}
-
-trap "exit 1" ERR
+. ../test-utils.sh
 
 if [ -f testdb ]; then rm -f testdb; fi
 
 ${AUDIODB} -d testdb -N
 
-# FIXME: endianness!
-printf "\x02\x00\x00\x00" > testfeature
-floatstring 0 >> testfeature
-floatstring 1 >> testfeature
-floatstring 1 >> testfeature
-floatstring 0 >> testfeature
+intstring 2 > testfeature
+floatstring 0 1 >> testfeature
+floatstring 1 0 >> testfeature
 
 ${AUDIODB} -d testdb -I -f testfeature
 
 echo "query point (0.0,0.5)"
-printf "\x02\x00\x00\x00" > testquery
-floatstring 0 >> testquery
-floatstring 0.5 >> testquery
+intstring 2 > testquery
+floatstring 0 0.5 >> testquery
 
 ${AUDIODB} -d testdb -Q point -f testquery > testoutput
 wc -l testoutput | grep 2
@@ -40,9 +22,8 @@
 wc -l testoutput | grep 1
 
 echo "query point (0.5,0.0)"
-printf "\x02\x00\x00\x00" > testquery
-floatstring 0.5 >> testquery
-floatstring 0 >> testquery
+intstring 2 > testquery
+floatstring 0.5 0 >> testquery
 
 ${AUDIODB} -d testdb -Q point -f testquery > testoutput
 wc -l testoutput | grep 2