# HG changeset patch # User mas01mc # Date 1221989637 0 # Node ID a36e9cc666ce091fbf00bb2abb918543d0af308c # Parent a6edbe97fddfa45e5b83c95c6319f67560cb8281 fixed error when queryPoint was one-past-the-end of the query track. Added test for this case. diff -r a6edbe97fddf -r a36e9cc666ce query.cpp --- a/query.cpp Wed Sep 10 18:55:16 2008 +0000 +++ b/query.cpp Sun Sep 21 09:33:57 2008 +0000 @@ -308,8 +308,8 @@ *vqpp = *qpp; if(usingQueryPoint) { - if(queryPoint > *nvp || queryPoint > *nvp - sequenceLength + 1) { - error("queryPoint > numVectors-wL+1 in query"); + if( !(queryPoint < *nvp && queryPoint < *nvp - sequenceLength + 1) ) { + error("queryPoint > numVectors-sequenceLength+1 in query"); } else { VERB_LOG(1, "query point: %u\n", queryPoint); *vqp = *qp + queryPoint * dbH->dim; @@ -415,8 +415,8 @@ *vqpp = *qpp; if(usingQueryPoint) { - if(queryPoint > *nvp || queryPoint > *nvp - sequenceLength + 1) { - error("queryPoint > numVectors-wL+1 in query"); + if( !(queryPoint < *nvp && queryPoint < *nvp - sequenceLength + 1) ) { + error("queryPoint > numVectors-sequenceLength+1 in query"); } else { VERB_LOG(1, "query point: %u\n", queryPoint); *vqp = *qp + queryPoint * dbH->dim; diff -r a6edbe97fddf -r a36e9cc666ce tests/0006/run-test.sh --- a/tests/0006/run-test.sh Wed Sep 10 18:55:16 2008 +0000 +++ b/tests/0006/run-test.sh Sun Sep 21 09:33:57 2008 +0000 @@ -26,6 +26,10 @@ echo testfeature 0 0 0 > test-expected-output cmp testoutput test-expected-output +# test query point past the end of query track +expect_clean_error_exit ${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -p 1 + + echo "query point (0.5,0.0)" intstring 2 > testquery floatstring 0.5 0 >> testquery