diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/00-setup.js | 2 | ||||
| -rw-r--r-- | test/02-test-rect.js | 56 |
2 files changed, 49 insertions, 9 deletions
diff --git a/test/00-setup.js b/test/00-setup.js new file mode 100644 index 0000000..8d06a13 --- /dev/null +++ b/test/00-setup.js @@ -0,0 +1,2 @@ +Error.stackTraceLimit = 1 + diff --git a/test/02-test-rect.js b/test/02-test-rect.js index 39693f5..0ae59f7 100644 --- a/test/02-test-rect.js +++ b/test/02-test-rect.js @@ -64,6 +64,13 @@ describe('rect', function(){ describe('#split(rect, east)', function(){ var s0 = rect.split(east) var s1 = east.split(rect) + + console.log("\n") + console.log(rect+"") + console.log(east+"") + console.log(s0.map(function(r){ return r.toString() })) + console.log(s1.map(function(r){ return r.toString() })) + it('splits on all 4 sides', function(){ assert.equal(ALL, sides(s0) | sides(s1)) }) @@ -92,13 +99,16 @@ describe('rect', function(){ describe('#split(rect, east_edge)', function(){ var s0 = rect.split(east_edge) var s1 = east_edge.split(rect) - - console.log("\n") - console.log(rect+"") - console.log(east_edge+"") - console.log(s0.map(function(r){ return r.toString() })) - console.log(s1.map(function(r){ return r.toString() })) - + it('has no degenerate vectors', function(){ + s0.forEach(function(r){ + assert.notEqual(0, r.x.magnitude()) + assert.notEqual(0, r.y.magnitude()) + }) + s1.forEach(function(r){ + assert.notEqual(0, r.x.magnitude()) + assert.notEqual(0, r.y.magnitude()) + }) + }) it('splits on all 4 sides', function(){ assert.equal(ALL, sides(s0) | sides(s1)) }) @@ -110,7 +120,35 @@ describe('rect', function(){ }) }) + return + describe('#split(rect, south)', function(){ + var s0 = rect.split(south) + var s1 = south.split(rect) + it('splits on all 4 sides', function(){ + assert.equal(ALL, sides(s0) | sides(s1)) + }) + it('rect is front/left/right', function(){ + assert.equal(FRONT | LEFT | RIGHT, sides(s0)) + }) + it('south is back/left/right', function(){ + assert.equal(BACK | LEFT | RIGHT, sides(s1)) + }) + }) + + describe('#split(rect, corner)', function(){ + var s0 = rect.split(corner) + var s1 = corner.split(rect) + + it('splits on all 4 sides', function(){ + // assert.equal(ALL, sides(s0) | sides(s1)) + }) + it('rect is front/left/right', function(){ + // assert.equal(FRONT | LEFT | RIGHT, sides(s0)) + }) + it('corner is back/left/right', function(){ +// assert.equal(BACK| LEFT | RIGHT, sides(s1)) + }) + }) + }) -/* -*/ |
