Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. @Test
  2. public void testR() {
  3. Rtriangle t = getRTriangle();
  4. //проверяем имеют ли все три точки разные координаты
  5. assertTrue(t.getApexX1() != t.getApexX2() || t.getApexY1() != t.getApexY2());
  6. assertTrue(t.getApexX2() != t.getApexX3() || t.getApexY2() != t.getApexY3());
  7. assertTrue(t.getApexX3() != t.getApexX1() || t.getApexY3() != t.getApexY1());
  8. //проверяем, является ли треугольник равнобедренным
  9. //также здесь вылетит ошибка, если все три точки расположены на одной линии
  10. int a = (t.getApexX1() - t.getApexX2())^2 + (t.getApexY1 - t.getApexY2())^2;
  11. int b = (t.getApexX2() - t.getApexX3())^2 + (t.getApexY2 - t.getApexY3())^2;
  12. int c = (t.getApexX3() - t.getApexX1())^2 + (t.getApexY3 - t.getApexY1())^2;
  13. assertTrue((a == b + c) || (b == a + c) || (c == b + a));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement