Files
mongo/jstests/core/geo_poly_edge.js
Randolph Tan 5595b94560 SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
2014-02-28 16:26:33 -05:00

23 lines
621 B
JavaScript

//
// Tests polygon edge cases
//
var coll = db.getCollection( 'jstests_geo_poly_edge' )
coll.drop();
coll.ensureIndex({ loc : "2d" })
coll.insert({ loc : [10, 10] })
coll.insert({ loc : [10, -10] })
assert.eq( coll.find({ loc : { $within : { $polygon : [[ 10, 10 ], [ 10, 10 ], [ 10, -10 ]] } } }).itcount(), 2 )
assert.eq( coll.find({ loc : { $within : { $polygon : [[ 10, 10 ], [ 10, 10 ], [ 10, 10 ]] } } }).itcount(), 1 )
coll.insert({ loc : [179, 0] })
coll.insert({ loc : [0, 179] })
assert.eq( coll.find({ loc : { $within : { $polygon : [[0, 0], [1000, 0], [1000, 1000], [0, 1000]] } } }).itcount(), 3 )