Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

passing box test

  • Loading branch information...
commit 276d575b5961f81a61158f45041322620f9931e7 1 parent eb4c1c9
@substack authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/boxes.js
View
13 test/boxes.js
@@ -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();
+});
Please sign in to comment.
Something went wrong with that request. Please try again.