diff options
author | Mathias Stearn <mathias@10gen.com> | 2014-03-27 16:15:09 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2014-03-27 17:35:16 -0400 |
commit | d0a1e84ab2fa1b6aa699721b5cb9a4f8d0bf3692 (patch) | |
tree | 7a1ffc91cb6cb176c1e367ea7641ab05032c862c /jstests/noPassthroughWithMongod/geo_polygon.js | |
parent | 719134aa7985c0a697f199fc78e323d04e3a65ad (diff) | |
download | mongo-d0a1e84ab2fa1b6aa699721b5cb9a4f8d0bf3692.tar.gz |
SERVER-13391 Rename slowNightly -> noPassthroughWithMongod and slowWeekly -> noPassthrough
This better represents their purpose and the difference between them.
Diffstat (limited to 'jstests/noPassthroughWithMongod/geo_polygon.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/geo_polygon.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/geo_polygon.js b/jstests/noPassthroughWithMongod/geo_polygon.js new file mode 100644 index 00000000000..25bf0269ccc --- /dev/null +++ b/jstests/noPassthroughWithMongod/geo_polygon.js @@ -0,0 +1,53 @@ +t = db.geo_polygon4; +t.drop(); + +shouldRun = true; + +bi = db.adminCommand( "buildinfo" ).sysInfo +if ( bi.indexOf( "erh2" ) >= 0 ){ + // this machine runs this test very slowly + // it seems to be related to osx 10.5 + // if this machine gets upgraded, we should remove this check + // the os x debug builders still run thistest, so i'm not worried about it + shouldRun = false; +} + +if ( shouldRun ) { + + num = 0; + for ( x = -180; x < 180; x += .5 ){ + for ( y = -180; y < 180; y += .5 ){ + o = { _id : num++ , loc : [ x , y ] }; + t.save( o ); + } + } + + var numTests = 31; + for( var n = 0; n < numTests; n++ ){ + t.dropIndexes() + t.ensureIndex( { loc : "2d" }, { bits : 2 + n } ); + + assert.between( 9 - 2 , t.find( { loc: { "$within": { "$polygon" : [[0,0], [1,1], [0,2]] }}} ).count() , 9, "Triangle Test", true); + assert.eq( num , t.find( { loc : { "$within" : { "$polygon" : [ [-180,-180], [-180,180], [180,180], [180,-180] ] } } } ).count() , "Bounding Box Test" ); + + assert.eq( 441 , t.find( { loc : { "$within" : { "$polygon" : [ [0,0], [0,10], [10,10], [10,0] ] } } } ).count() , "Square Test" ); + assert.eq( 25 , t.find( { loc : { "$within" : { "$polygon" : [ [0,0], [0,2], [2,2], [2,0] ] } } } ).count() , "Square Test 2" ); + + if(1){ // SERVER-3726 + // Points exactly on diagonals may be in or out, depending on how the error calculating the slope falls. + assert.between( 341 - 18 , t.find( { loc : { "$within" : { "$polygon" : [ [0,0], [0,10], [10,10], [10,0], [5,5] ] } } } ).count(), 341, "Square Missing Chunk Test", true ); + assert.between( 21 - 2 , t.find( { loc : { "$within" : { "$polygon" : [ [0,0], [0,2], [2,2], [2,0], [1,1] ] } } } ).count(), 21 , "Square Missing Chunk Test 2", true ); + } + + assert.eq( 1 , t.find( { loc: { "$within": { "$polygon" : [[0,0], [0,0], [0,0]] }}} ).count() , "Point Test" ); + + // SERVER-3725 + { + assert.eq( 5 , t.find( { loc: { "$within": { "$polygon" : [[0,0], [1,0], [2,0]] }}} ).count() , "Line Test 1" ); + assert.eq( 3 , t.find( { loc: { "$within": { "$polygon" : [[0,0], [0,0], [1,0]] }}} ).count() , "Line Test 2" ); + assert.eq( 5 , t.find( { loc: { "$within": { "$polygon" : [[0,2], [0,1], [0,0]] }}} ).count() , "Line Test 3" ); + } + + assert.eq( 3 , t.find( { loc: { "$within": { "$polygon" : [[0,1], [0,0], [0,0]] }}} ).count() , "Line Test 4" ); + } +} |