package tp1.ex2_1;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

/**
 * Suite de tests pour vérifier la méthode sqrt dans la classe Sqrt
 */
public class SolveEquationTest {
    @Test
    public void test1() {
        SolveEquation se = new SolveEquation(1.0, -2.0, -3.0);
        assertEquals(se.getNbSolutions(), 2);
        assertTrue(se.getSolutions().getE1()
                .equals(se.getSolutions().getE2()));
    }

    @Test
    public void test2() {
        double epsilon = 0.0001;
        SolveEquation se = new SolveEquation(1.0, 0.0, 0.0);
        assertEquals(se.getSolutions().getE1(),
                se.getSolutions().getE2(), epsilon);
        assertEquals(se.getNbSolutions(), 1);
    }

    @Test
    public void test3() {
        SolveEquation se = new SolveEquation(5.0, 0.0, 3.0);
        assertEquals(se.getSolutions().getE1(), se.getSolutions().getE2());
    }
}
