diff --git a/src/shamira/tests/test_gf256.py b/src/shamira/tests/test_gf256.py --- a/src/shamira/tests/test_gf256.py +++ b/src/shamira/tests/test_gf256.py @@ -30,7 +30,9 @@ class TestGF256(TestCase): self.assertEqual(evaluate([a0, a1, a2, a3], 1), a0^a1^a2^a3) # polynomial at 1 == sum of coefficients def test_get_constant_coef(self): - self.assertEqual(get_constant_coef((1, 1), (2, 2), (3, 3)), 0) + weights = compute_weights((1, 2, 3)) + ys = (1, 2, 3) + self.assertEqual(get_constant_coef(weights, ys), 0) random.seed(17) random_matches = 0 @@ -55,7 +57,10 @@ class TestGF256(TestCase): coefs = [random.randint(0, 255) for i in range(k)] points = [(j, evaluate(coefs, j)) for j in range(1, 256)] random.shuffle(points) - return (get_constant_coef(*points[:m]), coefs[0]) + + (xs, ys) = zip(*points[:m]) + weights = compute_weights(xs) + return (get_constant_coef(weights, ys), coefs[0]) if __name__=='__main__':