Esempio n. 1
0
 @Test
 public void divideByScalarReturnsNewPointWithEachCoordinateDividedByTheScalarValueSpecified()
     throws Exception {
   Point point = new Triple(8, 6, 12).divide(2);
   assertPointEquals(new Triple(4, 3, 6), point);
 }
Esempio n. 2
0
 @Test
 public void divideByScalarLeavesStateOfThisObjectUnchanged() throws Exception {
   Point point = new Triple(10, 20, 30);
   point.divide(5);
   assertPointEquals(new Triple(10, 20, 30), point);
 }
Esempio n. 3
0
 @Test
 public void addReturnsDifferenceOfTheTwoInvolvedPoints() throws Exception {
   Point point = new Triple(1, 2, 3).add((Point) new Triple(4, 5, 6));
   assertPointEquals(new Triple(5, 7, 9), point);
 }
Esempio n. 4
0
 @Test
 public void subtractRetunsDifferenceOfTheTwoInvolvedPoints() throws Exception {
   Point point = new Triple(1, 2, 3).subtract(new Triple(4, 5, 6));
   assertPointEquals(new Triple(-3, -3, -3), point);
 }
Esempio n. 5
0
 @Test
 public void addDoesNotChangeStateOfTheParameterPoint() throws Exception {
   Point point = new Triple(1, 2, 3);
   new Triple(4, 5, 6).add(point);
   assertPointEquals(new Triple(1, 2, 3), point);
 }
Esempio n. 6
0
 @Test
 public void addDoesNotChangeStateOfThisPoint() throws Exception {
   Point point = new Triple(1, 2, 3);
   point.add(new Triple(4, 5, 6));
   assertPointEquals(new Triple(1, 2, 3), point);
 }