From 8deae106ca0504db6ab3837f0e7cf76075911a81 Mon Sep 17 00:00:00 2001 From: Yghore <yhgore@gmail.com> Date: Tue, 24 Jan 2023 15:24:01 +0100 Subject: [PATCH] Test add --- src/test/java/fr/nancy/iut/SphereTest.java | 45 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/test/java/fr/nancy/iut/SphereTest.java b/src/test/java/fr/nancy/iut/SphereTest.java index 3342054..a86fef8 100644 --- a/src/test/java/fr/nancy/iut/SphereTest.java +++ b/src/test/java/fr/nancy/iut/SphereTest.java @@ -1,6 +1,8 @@ package fr.nancy.iut; import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import javax.vecmath.Point3d; @@ -8,10 +10,49 @@ import javax.vecmath.Point3d; * Created by dparsons on 12/08/15. */ public class SphereTest { + + private Sphere sphere, sphere1; + + @BeforeEach + public void before() + { + this.sphere = new Sphere(1.5); + this.sphere1 = new Sphere(2); + } + @Test public void testComputeVolume() throws Exception { - Sphere mySphere = new Sphere(1.5); - assertEquals(14.137166941154069, mySphere.computeVolume(), 0.0); + assertEquals(14.137166941154069, sphere.computeVolume(), 0.0); + } + + @Test + public void testDistanceTo() + { + assertEquals(0, sphere.distanceTo(sphere1), 0.0); + } + + @Test + public void testDistanceSquaredTo() + { + assertEquals(0, sphere.distanceTo(sphere1), 0.0); + } + + @Test + public void testContact() + { + assertEquals(true, sphere.distanceTo(sphere1)); + } + + @Test + public void testConstructeur() + { + Sphere sp = new Sphere(0.5); + assertEquals(0.5, sp.radius_); + assertEquals(0, sp.pos_.x); + assertEquals(0, sp.pos_.y); + assertEquals(0, sp.pos_.z); + + } } \ No newline at end of file -- GitLab