from Function import Function
import os

if __name__ == "__main__":
    start_time = os.times()[0]
    success = 0
    num_tests = 0
    ### _PARSE_INPUT Tests
    ##################################### GENERAL METHODS TESTS #############################################

    ## Instantiation of FUnction object doesn't matter here, it will be reused to test a method
    FAILED = []
    function = Function("f(x) = (x)")

    test_string = "f(x) = (x)"
    res = function._parse_input(test_string)
    if res[0] == "f" and res[1] == ["x"] and res[2] == ["x"]:
        success += 1
    else:
        FAILED.append((test_string, res[0], res[1], res[2]))
    num_tests += 1

    test_string = "f(x,y) = (x^2y^2, x)"
    res = function._parse_input(test_string)
    if res[0] == "f" and res[1] == ["x", "y"] and res[2] == ["x^2y^2", "x"]:
        success += 1
    else:
        FAILED.append((test_string, res[0], res[1], res[2]))
    num_tests += 1

    test_string = "function1name(varone, vartwo) = (varone, vartwo)"