Mercurial > hg > audiodb
changeset 341:a36e9cc666ce
fixed error when queryPoint was one-past-the-end of the query track. Added test for this case.
author | mas01mc |
---|---|
date | Sun, 21 Sep 2008 09:33:57 +0000 |
parents | a6edbe97fddf |
children | def30555ac89 |
files | query.cpp tests/0006/run-test.sh |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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