Skip to content
Snippets Groups Projects
Commit 1514025e authored by Almasty007's avatar Almasty007
Browse files

ajout des tests

parent 2f86a69b
No related branches found
No related tags found
No related merge requests found
Pipeline #10495 passed
...@@ -12,6 +12,7 @@ public class SphereTest { ...@@ -12,6 +12,7 @@ public class SphereTest {
public void testComputeVolume() throws Exception { public void testComputeVolume() throws Exception {
Sphere mySphere = new Sphere(1.5); Sphere mySphere = new Sphere(1.5);
assertEquals(9.42477796076938, mySphere.computeVolume(), 0.0); assertEquals(9.42477796076938, mySphere.computeVolume(), 0.0);
} }
@Test @Test
...@@ -19,6 +20,35 @@ public class SphereTest { ...@@ -19,6 +20,35 @@ public class SphereTest {
Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5)); Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5));
Sphere mySphere2 = new Sphere(1,new Point3d(10, 15, 6)); Sphere mySphere2 = new Sphere(1,new Point3d(10, 15, 6));
assertEquals(1, mySphere.distanceSquaredTo(mySphere2)); assertEquals(1, mySphere.distanceSquaredTo(mySphere2));
assertEquals(1, mySphere.distanceTo(mySphere2));
}
@Test
public void testContact() throws Exception {
Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5));
Sphere mySphere2 = new Sphere(1,new Point3d(10, 15, 6));
Sphere mySphere3 = new Sphere(1,new Point3d(100, 15, 6));
assertEquals(true, mySphere2.inContactWith(mySphere2) );
assertEquals(false, mySphere2.inContactWith(mySphere3) );
Sphere mySphere4 = new Sphere(1);
Sphere mySphere5 = new Sphere(1);
assertEquals(true, mySphere4.inContactWith(mySphere5));
} }
@Test
public void testGetters() throws Exception {
Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5));
assertEquals(new Point3d(10, 15, 5), mySphere.getPos());
assertEquals(1, mySphere.getRadius());
}
@Test
public void testCreerCercle() throws Exception {
Sphere s1 = new Sphere();
assertEquals(0, s1.getRadius());
assertEquals(new Point3d(), s1.getPos());
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment