from parser import Parser


def test_Parser():
    parser = Parser("(-b + sqrt(b^2-4a c))/(2a)")

    assert parser.variables_names == {"c", "a", "b"}

    assert parser.evaluate({"a": 1, "b": -3, "c": 2}) == 1.0

    assert all(
        parser.evaluate({"a": [1, 1, 1], "b": [-5, -6, -9], "c": [6, 9, 20]})
        == [2.0, 3.0, 4.0]
    )
