Mercurial > hg > audiodb
changeset 45:538064755914
Add (failing) query test
author | mas01cr |
---|---|
date | Mon, 17 Sep 2007 15:23:06 +0000 |
parents | 09275a49cb51 |
children | 1853beeb0521 |
files | tests/0003/run-test.sh tests/0004/run-test.sh |
diffstat | 2 files changed, 56 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- /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