You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/06/07 11:58:37 UTC

lucene-solr:branch_6x: LUCENE-7316: improve test

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 3ee694eb8 -> bacac1c33


LUCENE-7316: improve test


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/bacac1c3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bacac1c3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bacac1c3

Branch: refs/heads/branch_6x
Commit: bacac1c333b26a233011546ec4b3fa5e832ab49b
Parents: 3ee694e
Author: Mike McCandless <mi...@apache.org>
Authored: Tue Jun 7 07:56:53 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Tue Jun 7 07:57:35 2016 -0400

----------------------------------------------------------------------
 .../apache/lucene/spatial3d/TestGeo3DPoint.java | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bacac1c3/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
index d651491..69f5999 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
@@ -238,6 +238,29 @@ public class TestGeo3DPoint extends LuceneTestCase {
         log.println("  root cell: " + root);
       }
 
+      // make sure the root cell (XYZBounds) does in fact contain all points that the shape contains
+      {
+        boolean fail = false;
+        for(int docID=0;docID<numDocs;docID++) {
+          if (root.contains(docs[docID]) == false) {
+            boolean expected = shape.isWithin(unquantizedDocs[docID]);
+            if (expected) {
+              log.println("    doc=" + docID + " is contained by shape but is outside the returned XYZBounds");
+              log.println("      unquantized=" + unquantizedDocs[docID]);
+              log.println("      quantized=" + docs[docID]);
+              fail = true;
+            }
+          }
+        }
+
+        if (fail) {
+          log.println("  shape=" + shape);
+          log.println("  bounds=" + bounds);
+          System.out.print(sw.toString());
+          fail("invalid bounds for shape=" + shape);
+        }
+      }
+
       List<Cell> queue = new ArrayList<>();
       queue.add(root);
       Set<Integer> hits = new HashSet<>();
@@ -1201,7 +1224,6 @@ public class TestGeo3DPoint extends LuceneTestCase {
       if (encoded != Integer.MAX_VALUE) {
         // this is the next representable value
         // all double values between [min .. max) should encode to the current integer
-        // all double values between (min .. max] should encodeCeil to the next integer.
         double max = min + Geo3DUtil.DECODE;
         assertEquals(max, Geo3DUtil.decodeValueFloor(encoded+1), 0.0D);
         assertEquals(encoded+1, Geo3DUtil.encodeValue(max));