|
|
@ -45,7 +45,7 @@ class Vector2Test { |
|
|
|
// assert |
|
|
|
assertThat(expected).isEqualTo(result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
void Vector2_clone_createsClone() { |
|
|
|
// arrange |
|
|
@ -57,4 +57,40 @@ class Vector2Test { |
|
|
|
// assert |
|
|
|
assertThat(clone).isEqualTo(comparator); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void Vector2_isWithin_returnsTrueWhenWithin() { |
|
|
|
// arrange |
|
|
|
Vector2 area = new Vector2(30, 30); |
|
|
|
Vector2 point = new Vector2(2, 8); |
|
|
|
// act |
|
|
|
boolean isWithin = point.isWithin(area); |
|
|
|
boolean expectedWithin = true; |
|
|
|
// assert |
|
|
|
assertThat(isWithin).isEqualTo(expectedWithin); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void Vector2_isWithin_returnsFalseWhenOutside() { |
|
|
|
// arrange |
|
|
|
Vector2 area = new Vector2(30, 30); |
|
|
|
Vector2 point = new Vector2(53, 8); |
|
|
|
// act |
|
|
|
boolean isWithin = point.isWithin(area); |
|
|
|
boolean expectedWithin = false; |
|
|
|
// assert |
|
|
|
assertThat(isWithin).isEqualTo(expectedWithin); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void Vector2_isWithin_returnsFalseOnEqual() { |
|
|
|
// arrange |
|
|
|
Vector2 area = new Vector2(30, 30); |
|
|
|
Vector2 point = new Vector2(30, 15); |
|
|
|
// act |
|
|
|
boolean isWithin = point.isWithin(area); |
|
|
|
boolean expectedWithin = false; |
|
|
|
// assert |
|
|
|
assertThat(isWithin).isEqualTo(expectedWithin); |
|
|
|
} |
|
|
|
} |