From 244741f31e508e6271b7235479ac4528208bbf2d Mon Sep 17 00:00:00 2001 From: Maxence <maxence.antoine.etu@univ-lille.fr> Date: Thu, 24 Oct 2024 11:17:15 +0200 Subject: [PATCH] Ajout de tests Iris et Classification --- .../model/ClassificationModelTest.java | 24 +++++++++ .../sae/classification/model/IrisTest.java | 54 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/test/java/fr/univlille/sae/classification/model/ClassificationModelTest.java create mode 100644 src/test/java/fr/univlille/sae/classification/model/IrisTest.java diff --git a/src/test/java/fr/univlille/sae/classification/model/ClassificationModelTest.java b/src/test/java/fr/univlille/sae/classification/model/ClassificationModelTest.java new file mode 100644 index 0000000..e8ed459 --- /dev/null +++ b/src/test/java/fr/univlille/sae/classification/model/ClassificationModelTest.java @@ -0,0 +1,24 @@ +package fr.univlille.sae.classification.model; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class ClassificationModelTest { + + @Test + void getClassificationModel() { + } + + @Test + void getDatas() { + } + + @Test + void getDataToClass() { + } + + @Test + void getType() { + } +} \ No newline at end of file diff --git a/src/test/java/fr/univlille/sae/classification/model/IrisTest.java b/src/test/java/fr/univlille/sae/classification/model/IrisTest.java new file mode 100644 index 0000000..9ca8f9f --- /dev/null +++ b/src/test/java/fr/univlille/sae/classification/model/IrisTest.java @@ -0,0 +1,54 @@ +package fr.univlille.sae.classification.model; +import javafx.scene.paint.Color; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class IrisTest { + + Iris iris = new Iris(3.0, 2.8, 4.1, 1.9, "Setosa"); + + @Test + void getSepalWidth() { + assertEquals(3.0 , iris.getSepalWidth()); + } + + @Test + void getSepalLength() { + assertEquals(2.8, iris.getSepalLength()); + } + + @Test + void getPetalWidth() { + assertEquals(4.1, iris.getPetalWidth()); + } + + @Test + void getPetalLength() { + assertEquals(1.9, iris.getPetalLength()); + } + + @Test + void getVariety() { + assertEquals("Setosa", iris.getVariety()); + } + + @Test + void getDataType() { + assertEquals(3.0 , iris.getDataType("sepalWidth")); + assertEquals(2.8, iris.getDataType("sepalLength")); + assertEquals(4.1, iris.getDataType("petalWidth")); + assertEquals(1.9, iris.getDataType("petalLength")); + } + + @Test + void getColor() { + assertEquals(Color.RED, iris.getColor()); + } + + @Test + void testToString() { + assertEquals("Iris{sepalWidth=3.0, sepalLength=2.8, petalWidth=4.1, petalLength=1.9}", iris.toString()); + } +} \ No newline at end of file -- GitLab