Skip to content

Commit

Permalink
passing box test
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Dec 31, 2011
1 parent eb4c1c9 commit 276d575
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/boxes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var test = require('tap').test;
var inside = require('point-in-polygon');

test('box', function (t) {
var polygon = [ [ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ] ];
t.ok(inside([ 1.5, 1.5 ], polygon));
t.ok(inside([ 1.2, 1.9 ], polygon));
t.ok(!inside([ 0, 1.9 ], polygon));
t.ok(!inside([ 1.5, 2 ], polygon));
t.ok(!inside([ 1.5, 2.2 ], polygon));
t.ok(!inside([ 3, 5 ], polygon));
t.end();
});

0 comments on commit 276d575

Please sign in to comment.