diff options
author | Spencer T Brody <spencer@10gen.com> | 2011-08-30 13:58:35 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2011-08-30 13:59:57 -0400 |
commit | b7a4d0ff79a344d1208d9a0115adce9da4399344 (patch) | |
tree | 21ce00dcbaaae2b8177242478c5324ee01cda02b | |
parent | 6b61f6a212899ebfa21e1ca49d9954fce797bc80 (diff) | |
download | mongo-b7a4d0ff79a344d1208d9a0115adce9da4399344.tar.gz |
Fix some geo polygon tests which weren't testing as much as they meant to.
-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 +} |