Test nodeIntersect

This commit is contained in:
Tom MacWright
2012-12-04 18:24:55 -05:00
parent 436712fb78
commit 7828fa34c1

View File

@@ -35,6 +35,22 @@ describe('Util', function() {
expect(iD.util.geo.interp(a, b, 0)).to.eql({ lat: 0, lon: 0});
});
});
describe('#nodeIntersect', function() {
it('correctly says that a node is in an extent', function() {
expect(iD.util.geo.nodeIntersect({
lat: 0, lon: 0
}, [
[-180, 90],
[180, -90]])).to.be.true;
});
it('correctly says that a node is outside of an extent', function() {
expect(iD.util.geo.nodeIntersect({
lat: 0, lon: 0
}, [
[100, 90],
[180, -90]])).to.be.false;
});
});
describe('#dist', function() {
it('distance between two same points is zero', function() {
var a = [0, 0],