Permalink
Browse files

Tidy up one geo test re-examined in light of server-1392.

  • Loading branch information...
1 parent 3797fc0 commit 476de4f3acdac178209369bd7663f3d783830fc7 @kreuter kreuter committed Jul 15, 2010
Showing with 15 additions and 4 deletions.
  1. +15 −4 jstests/geo_box3.js
View
@@ -3,23 +3,34 @@
// doesn't include the center of the index, and put a point inside the
// bounding box.
-// This is the bug reported in SERVER-994, modulo 1000000.
+// This is the bug reported in SERVER-994.
+t=db.geo_box3;
+t.drop();
+t.insert({ point : { x : -15000000, y : 10000000 } });
+t.ensureIndex( { point : "2d" } , { min : -21000000 , max : 21000000 } );
+var c=t.find({point: {"$within": {"$box": [[-20000000, 7000000], [0, 15000000]]} } });
+assert.eq(1, c.count(), "A1");
+
+// Same thing, modulo 1000000.
t=db.geo_box3;
t.drop();
t.insert({ point : { x : -15, y : 10 } });
t.ensureIndex( { point : "2d" } , { min : -21 , max : 21 } );
-t.find({point: {"$within": {"$box": [[-20, 7], [0, 15]]} } });
+var c=t.find({point: {"$within": {"$box": [[-20, 7], [0, 15]]} } });
+assert.eq(1, c.count(), "B1");
// Two more examples, one where the index is centered at the origin,
// one not.
t=db.geo_box3;
t.drop();
t.insert({ point : { x : 1.0 , y : 1.0 } });
t.ensureIndex( { point : "2d" } , { min : -2 , max : 2 } );
-t.find({point: {"$within": {"$box": [[.1, .1], [1.99, 1.99]]} } });
+var c=t.find({point: {"$within": {"$box": [[.1, .1], [1.99, 1.99]]} } });
+assert.eq(1, c.count(), "C1");
t=db.geo_box3;
t.drop();
t.insert({ point : { x : 3.9 , y : 3.9 } });
t.ensureIndex( { point : "2d" } , { min : 0 , max : 4 } );
-t.find({point: {"$within": {"$box": [[2.05, 2.05], [3.99, 3.99]]} } });
+var c=t.find({point: {"$within": {"$box": [[2.05, 2.05], [3.99, 3.99]]} } });
+assert.eq(1, c.count(), "D1");

0 comments on commit 476de4f

Please sign in to comment.