Fix jUnit test problem with exclusive range if upper==lower (thanks to Michael McCandless):

[junit] junit.framework.AssertionFailedError: Returned count of  
range query must be equal to exclusive range length expected:<0> but  
was:<-1>
at org.apache.lucene.search.trie.TestTrieRangeQuery.testRangeSplit(TestTrieRangeQuery.java:203)


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@740442 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-02-03 21:05:29 +00:00
parent 35d2b765be
commit b2c04094ef
1 changed files with 2 additions and 2 deletions

View File

@ -196,11 +196,11 @@ public class TestTrieRangeQuery extends LuceneTestCase
// test inclusive range // test inclusive range
TrieRangeQuery tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), true, true, variant); TrieRangeQuery tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), true, true, variant);
TopDocs tTopDocs = searcher.search(tq, 1); TopDocs tTopDocs = searcher.search(tq, 1);
assertEquals("Returned count of range query must be equal to inclusive range length", tTopDocs.totalHits, upper-lower+1 ); assertEquals("Returned count of range query must be equal to inclusive range length", tTopDocs.totalHits, Math.max(upper-lower+1, 0) );
// test exclusive range // test exclusive range
tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), false, false, variant); tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), false, false, variant);
tTopDocs = searcher.search(tq, 1); tTopDocs = searcher.search(tq, 1);
assertEquals("Returned count of range query must be equal to exclusive range length", tTopDocs.totalHits, upper-lower-1 ); assertEquals("Returned count of range query must be equal to exclusive range length", tTopDocs.totalHits, Math.max(upper-lower-1, 0) );
// test left exclusive range // test left exclusive range
tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), false, true, variant); tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), false, true, variant);
tTopDocs = searcher.search(tq, 1); tTopDocs = searcher.search(tq, 1);