Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void testR() {
- Rtriangle t = getRTriangle();
- //проверяем имеют ли все три точки разные координаты
- assertTrue(t.getApexX1() != t.getApexX2() || t.getApexY1() != t.getApexY2());
- assertTrue(t.getApexX2() != t.getApexX3() || t.getApexY2() != t.getApexY3());
- assertTrue(t.getApexX3() != t.getApexX1() || t.getApexY3() != t.getApexY1());
- //проверяем, является ли треугольник равнобедренным
- //также здесь вылетит ошибка, если все три точки расположены на одной линии
- int a = (t.getApexX1() - t.getApexX2())^2 + (t.getApexY1 - t.getApexY2())^2;
- int b = (t.getApexX2() - t.getApexX3())^2 + (t.getApexY2 - t.getApexY3())^2;
- int c = (t.getApexX3() - t.getApexX1())^2 + (t.getApexY3 - t.getApexY1())^2;
- assertTrue((a == b + c) || (b == a + c) || (c == b + a));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement