예제 #1
0
 def test_integridad_falla(self):
     COEFICIENTES = [
         (2, 3, 0),
         (-2, 0, 4),
         (2, 0, -4),
     ]
     for a, b, c in COEFICIENTES:
         raices = buscar_raices(a, b, c)
         coeficientes = buscar_coeficientes(raices[0], raices[1])
         self.assertNotEqual(coeficientes, (a, b, c))
예제 #2
0
 def test_integridad(self):
     RAICES = [
         (0, 0),
         (1, 2),
         (2.5, 3.5),
         (100, 1000),
     ]
     for r1, r2 in RAICES:
         a, b, c = buscar_coeficientes(r1, r2)
         raices = buscar_raices(a, b, c)
         self.assertEquals(raices, (r1, r2))
예제 #3
0
    def test_formar_poliniomio(self):
        RAICES_COEFICIENTES = [
            ((1, 1), (1, -2, 1)),
            ((0, 0), (1, 0, 0)),
            ((2, -2), (1, 0, -4)),
            ((-4, 3), (1, 1, -12)),
        ]

        for raices, coeficientes_esperados in RAICES_COEFICIENTES:
            coeficientes = buscar_coeficientes(raices[0], raices[1])
            self.assertEquals(coeficientes, coeficientes_esperados)