diff options
-rw-r--r-- | jstests/geo_polygon1.js | 11 | ||||
-rw-r--r-- | jstests/geo_polygon3.js | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/jstests/geo_polygon1.js b/jstests/geo_polygon1.js index 481c0fe1147..4b7427a4da2 100644 --- a/jstests/geo_polygon1.js +++ b/jstests/geo_polygon1.js @@ -52,20 +52,23 @@ 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 try{ t.find( { loc : { $within : { $polygon : [1, 2] } } } ).toArray() - assert( false ) + okay = false } catch(e){} +assert(okay) try{ t.find( { loc : { $within : { $polygon : [[1, 2]] } } } ).toArray() - assert( false ) + okay = false } catch(e){} +assert(okay) try{ t.find( { loc : { $within : { $polygon : [[1, 2], [2, 3]] } } } ).toArray() - assert( false ) + okay = false } catch(e){} - +assert(okay) diff --git a/jstests/geo_polygon3.js b/jstests/geo_polygon3.js index d1438e67c00..bc00a39ff10 100644 --- a/jstests/geo_polygon3.js +++ b/jstests/geo_polygon3.js @@ -4,7 +4,7 @@ var numTests = 30; -for( var t = 0; t < numTests; t++ ){ +for( var n = 0; n < numTests; n++ ){ t = db.geo_polygon1; t.drop(); @@ -17,7 +17,7 @@ for( var t = 0; t < numTests; t++ ){ } } - t.ensureIndex( { loc : "2d" }, { bits : 2 + t } ); + t.ensureIndex( { loc : "2d" }, { bits : 2 + n } ); triangle = [[0,0], [1,1], [0,2]]; @@ -51,5 +51,4 @@ for( var t = 0; t < numTests; t++ ){ 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" ); - -}
\ No newline at end of file +} |