import junit.framework.TestCase; public class TriangleTest extends TestCase { /* Triangle isocele */ private boolean triangleEstIsocele(int a, int b, int c) { Triangle t = new Triangle(a, b, c); return t.estIsocele(); } public void testCasTriangleIsocele1() { assertFalse(triangleEstIsocele(2, 3, 4)); } public void testCasTriangleIsocele2() { assertTrue(triangleEstIsocele(2, 2, 3)); } public void testCasTriangleIsocele3() { assertTrue(triangleEstIsocele(2, 3, 2)); } public void testCasTriangleIsocele4() { assertTrue(triangleEstIsocele(3, 2, 2)); } public void testCasTriangleIsocele5() { assertTrue(triangleEstIsocele(2, 2, 2)); } /* Triangle equilateral */ public void testCasTriangleEquilateral1() { Triangle t = new Triangle(2, 2, 2); assertTrue(t.estEquilateral()); } public void testCasTriangleEquilateral2() { Triangle t = new Triangle(2, 3, 2); assertFalse(t.estEquilateral()); } /* Triangle rectangle */ public void testCasTriangleRectangle1() { Triangle t = new Triangle(2, 2, 5); assertFalse(t.estRectangle()); } public void testCasTriangleRectangle2() { Triangle t = new Triangle(3, 4, 5); assertTrue(t.estRectangle()); } /* Triangle scalen */ /* rectangle */ public void testCasTriangleScalen1() { Triangle t = new Triangle(3, 4, 5); assertFalse(t.estScalen()); } /* isocele */ public void testCasTriangleScalen2() { Triangle t = new Triangle(2, 2, 3); assertFalse(t.estScalen()); } /* equilateral */ public void testCasTriangleScalen3() { Triangle t = new Triangle(2, 2, 2); assertFalse(t.estScalen()); } /* quelconque */ public void testCasTriangleScalen4() { Triangle t = new Triangle(1, 4, 8); assertTrue(t.estScalen()); } /* Surface */ public void testSurface1() { Triangle t = new Triangle(1, 1, 2); assertEquals(0, t.surface(), 0); } public void testSurface2() { Triangle t = new Triangle(2, 2, 1); assertEquals(0.96, t.surface(), 0.01); } }