diff options
Diffstat (limited to 'jstests/core/geo_polygon1.js')
-rw-r--r-- | jstests/core/geo_polygon1.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/jstests/core/geo_polygon1.js b/jstests/core/geo_polygon1.js index 7af6d06bebd..de2652e69bc 100644 --- a/jstests/core/geo_polygon1.js +++ b/jstests/core/geo_polygon1.js @@ -25,7 +25,7 @@ boxBounds = [ [0,0], [0,10], [10,10], [10,0] ]; assert.eq( num , t.find( { loc : { "$within" : { "$polygon" : boxBounds } } } ).count() , "Bounding Box Test" ); //Make sure we can add object-based polygons -assert.eq( num, t.find( { loc : { $within : { $polygon : { a : [-10, -10], b : [-10, 10], c : [10, 10], d : [10, -10] } } } } ).count() ) +assert.eq( num, t.find( { loc : { $within : { $polygon : { a : [-10, -10], b : [-10, 10], c : [10, 10], d : [10, -10] } } } } ).count() ); // Look in a box much bigger than the one we have data in boxBounds = [[-100,-100], [-100, 100], [100,100], [100,-100]]; @@ -44,30 +44,30 @@ assert.commandWorked(t.ensureIndex( { loc : "2d" } )); assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman single point" ); -t.save({ loc : [5, 3] }) // Add a point that's out right in the mouth opening -t.save({ loc : [3, 7] }) // Add a point above the center of the head -t.save({ loc : [3,-1] }) // Add a point below the center of the bottom +t.save({ loc : [5, 3] }); // Add a point that's out right in the mouth opening +t.save({ loc : [3, 7] }); // Add a point above the center of the head +t.save({ loc : [3,-1] }); // Add a point below the center of the bottom assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman double point" ); // Make sure we can't add bad polygons -okay = true +okay = true; try{ - t.find( { loc : { $within : { $polygon : [1, 2] } } } ).toArray() - okay = false + t.find( { loc : { $within : { $polygon : [1, 2] } } } ).toArray(); + okay = false; } catch(e){} -assert(okay) +assert(okay); try{ - t.find( { loc : { $within : { $polygon : [[1, 2]] } } } ).toArray() - okay = false + t.find( { loc : { $within : { $polygon : [[1, 2]] } } } ).toArray(); + okay = false; } catch(e){} -assert(okay) +assert(okay); try{ - t.find( { loc : { $within : { $polygon : [[1, 2], [2, 3]] } } } ).toArray() - okay = false + t.find( { loc : { $within : { $polygon : [[1, 2], [2, 3]] } } } ).toArray(); + okay = false; } catch(e){} -assert(okay) +assert(okay); |