From 223086cb85a16d20bfc0d8928fe8fe63047b324a Mon Sep 17 00:00:00 2001
From: noapo <noa.pozzodiborgo@gmail.com>
Date: Tue, 24 Jan 2023 15:22:20 +0100
Subject: [PATCH] =?UTF-8?q?test=20=C3=A0=20100%?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/test/java/fr/nancy/iut/SphereTest.java | 64 ++++++++++++++++++++--
 1 file changed, 59 insertions(+), 5 deletions(-)

diff --git a/src/test/java/fr/nancy/iut/SphereTest.java b/src/test/java/fr/nancy/iut/SphereTest.java
index 31b0633..3295f40 100644
--- a/src/test/java/fr/nancy/iut/SphereTest.java
+++ b/src/test/java/fr/nancy/iut/SphereTest.java
@@ -9,15 +9,69 @@ import javax.vecmath.Point3d;
  */
 public class SphereTest {
   @Test
-  public void testComputeVolume() throws Exception {
+  public void testConstructeurSansParametre()
+  {
+    Sphere s1 = new Sphere();
+    assertEquals(0.0, s1.getRadius(), 0.0);
+  }
+
+  @Test
+  public void testContructeurParametre()
+  {
+    Sphere s1 = new Sphere(5.0);
+    assertEquals(5.0, s1.getRadius(), 0.0);
+  }
+
+
+  @Test
+  public void testContructeurParametres()
+  {
+    Sphere s1 = new Sphere(5.0, new Point3d(1.0, 2.0, 3.0));
+    assertEquals(5.0, s1.getRadius(), 0.0);
+    assertEquals(1.0, s1.getPos().x, 0.0);
+  }
+
+
+  @Test
+  public void testComputeVolume() throws Exception
+  {
     Sphere mySphere = new Sphere(1.5);
     assertEquals(14.137166941154069, mySphere.computeVolume(), 0.0);
   }
 
+
   @Test
-  public void testDistanceSquaredTo() throws Exception {
-    Sphere mySphere = new Sphere(1.5);
-    Sphere otherSphere = new Sphere(1.5);
-    assertEquals(0.0, mySphere.distanceSquaredTo(otherSphere), 0.0);
+  public void testDistanceTo() throws Exception
+  {
+    Sphere s1 = new Sphere(1.5, new Point3d(1.0, 2.0, 3.0));
+    Sphere autre = new Sphere(1.5, new Point3d(2.0, 3.0, 4.0));
+    assertEquals(1.7320508075688772, s1.distanceTo(autre), 0.0);
   }
+
+
+  @Test
+  public void testDistanceSquaredTo() throws Exception
+  {
+    Sphere s1 = new Sphere(1.5, new Point3d(1.0, 2.0, 3.0));
+    Sphere autre = new Sphere(1.5, new Point3d(2.0, 3.0, 4.0));
+    assertEquals(3.0, s1.distanceSquaredTo(autre), 0.0);
+  }
+
+
+  @Test
+  public void testInContactWithTrue() throws Exception
+  {
+    Sphere s1 = new Sphere(1.5, new Point3d(1.0, 2.0, 3.0));
+    Sphere autre = new Sphere(1.5, new Point3d(2.0, 3.0, 4.0));
+    assertTrue(s1.inContactWith(autre));
+  }
+
+  @Test
+  public void testInContactWithFalse() throws Exception
+  {
+    Sphere s1 = new Sphere(1.5, new Point3d(1.0, 2.0, 3.0));
+    Sphere autre = new Sphere(1, new Point3d(10.0, 50.0, 40.0));
+    assertFalse(s1.inContactWith(autre));
+  }
+
 }
\ No newline at end of file
-- 
GitLab