From 2bbef1390c6ebfbad4f691c4558220142bcc989e Mon Sep 17 00:00:00 2001 From: Yghore <yhgore@gmail.com> Date: Tue, 24 Jan 2023 15:34:40 +0100 Subject: [PATCH] =?UTF-8?q?CHACAL=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/fr/nancy/iut/SphereTest.java | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/test/java/fr/nancy/iut/SphereTest.java b/src/test/java/fr/nancy/iut/SphereTest.java index a86fef8..1a05325 100644 --- a/src/test/java/fr/nancy/iut/SphereTest.java +++ b/src/test/java/fr/nancy/iut/SphereTest.java @@ -11,48 +11,55 @@ import javax.vecmath.Point3d; */ 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 sphere = new Sphere(1.5); + Sphere sphere1 = new Sphere(2); assertEquals(14.137166941154069, sphere.computeVolume(), 0.0); } @Test public void testDistanceTo() { + Sphere sphere = new Sphere(1.5); + Sphere sphere1 = new Sphere(2); assertEquals(0, sphere.distanceTo(sphere1), 0.0); } @Test public void testDistanceSquaredTo() { + Sphere sphere = new Sphere(1.5); + Sphere sphere1 = new Sphere(2); assertEquals(0, sphere.distanceTo(sphere1), 0.0); } @Test public void testContact() { - assertEquals(true, sphere.distanceTo(sphere1)); + Sphere sphere = new Sphere(1.5); + Sphere sphere1 = new Sphere(2); + assertEquals(true, sphere.inContactWith(sphere1)); + assertEquals(0.0, sphere.distanceSquaredTo(sphere1)); + assertEquals(false, sphere.inContactWith(new Sphere(1.5, new Point3d(5,10,5)))); } @Test public void testConstructeur() { + Sphere sp1 = new Sphere(); Sphere sp = new Sphere(0.5); - assertEquals(0.5, sp.radius_); + assertEquals(0.5, sp.getRadius()); assertEquals(0, sp.pos_.x); - assertEquals(0, sp.pos_.y); + assertEquals(0, sp.getPos().y); assertEquals(0, sp.pos_.z); + + } } \ No newline at end of file -- GitLab