Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Commit

Permalink
Tests for bounds checkiing
Browse files Browse the repository at this point in the history
  • Loading branch information
vapour101 committed Sep 15, 2017
1 parent d0ef618 commit 3b7f7b5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/java/util/CoordProjectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,20 @@ public void toBoardCoords() {
projection = proj.nearestCoords(new DrawCoords(40, 40));
assertThat(projection, is(getCoords("T19")));
}

@Test
public void boundsChecking() {
CoordProjector projector = new CoordProjector(20, new DrawCoords(3.4, 5.6));
DrawCoords check1 = new DrawCoords(10, 10);
DrawCoords check2 = new DrawCoords(3, 10);
DrawCoords check3 = new DrawCoords(5, 0);
DrawCoords check4 = new DrawCoords(27, 10);
DrawCoords check5 = new DrawCoords(8, 30);

assertThat(projector.isWithinBounds(check1), is(true));
assertThat(projector.isWithinBounds(check2), is(false));
assertThat(projector.isWithinBounds(check3), is(false));
assertThat(projector.isWithinBounds(check4), is(false));
assertThat(projector.isWithinBounds(check5), is(false));
}
}

0 comments on commit 3b7f7b5

Please sign in to comment.