# HG changeset patch # User mas01cr # Date 1190042586 0 # Node ID 538064755914efdd3c8c6088b8236a2c4a45c1bd # Parent 09275a49cb51ffa339d0055f231289c13b63655e Add (failing) query test diff -r 09275a49cb51 -r 538064755914 tests/0003/run-test.sh --- a/tests/0003/run-test.sh Mon Sep 17 14:33:54 2007 +0000 +++ b/tests/0003/run-test.sh Mon Sep 17 15:23:06 2007 +0000 @@ -6,6 +6,10 @@ ${AUDIODB} -d testdb -N +# We could contemplate putting the test feature (and the expected +# query output) under svn control if we trust its binary file +# handling. + # FIXME: endianness! printf "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x3f" > testfeature diff -r 09275a49cb51 -r 538064755914 tests/0004/run-test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0004/run-test.sh Mon Sep 17 15:23:06 2007 +0000 @@ -0,0 +1,52 @@ +#! /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 + +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 + +${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 + +${AUDIODB} -d testdb -Q point -f testquery > testoutput +wc -l testoutput | grep 2 +${AUDIODB} -d testdb -Q point -f testquery -n 1 > testoutput +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 + +${AUDIODB} -d testdb -Q point -f testquery > testoutput +wc -l testoutput | grep 2 +${AUDIODB} -d testdb -Q point -f testquery -n 1 > testoutput +wc -l testoutput | grep 1 + +exit 104