lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r740442 - /lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java
Date Tue, 03 Feb 2009 21:05:30 GMT
Author: uschindler
Date: Tue Feb  3 21:05:29 2009
New Revision: 740442

URL: http://svn.apache.org/viewvc?rev=740442&view=rev
Log:
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)

Modified:
    lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java?rev=740442&r1=740441&r2=740442&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java
(original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java
Tue Feb  3 21:05:29 2009
@@ -196,11 +196,11 @@
       // 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);



Mime
View raw message