mirror of https://github.com/apache/lucene.git
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:
parent
35d2b765be
commit
b2c04094ef
|
@ -196,11 +196,11 @@ public class TestTrieRangeQuery extends LuceneTestCase
|
|||
// test inclusive range
|
||||
TrieRangeQuery tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), true, true, variant);
|
||||
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
|
||||
tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), false, false, variant);
|
||||
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
|
||||
tq=new TrieRangeQuery(field, new Long(lower), new Long(upper), false, true, variant);
|
||||
tTopDocs = searcher.search(tq, 1);
|
||||
|
|
Loading…
Reference in New Issue