main.py
def evaluate_code(testcases: List[Dict[str, str]], code_src: str):
    """
    Runs the Lab codes against the correct code cases and then checks their outputs.
    Prints 'Success' if they satisfy all the test cases successfully else if they fail
    shows them their output and the expected output
    """

    executable, extension = os.path.splitext(code_src)
    compile_code(executable, code_src)
    for testcase in testcases:
        print(
            f"Testing code for input: '{testcase.get('input').decode().rstrip()}' .....")
        curr_output = run_code(executable, testcase.get('input'))
        if curr_output == testcase.get('output'):
            print("Success!")
            print("")
        else:
            print(
                f"Failure!\nExpected Output: \n{testcase.get('output').decode()}\nActual Output: \n{curr_output.decode()}")
            print("")

    Runs the Lab codes against the correct code cases and then checks their outputs.
    Prints 'Success' if they satisfy all the test cases successfully else if they fail
    shows them their output and the expected output
    
Runs the Lab codes against the correct code cases and then checks their outputs.
Prints 'Success' if they satisfy all the test cases successfully else if they fail
shows them their output and the expected output
Runs the Lab codes against the correct code cases and then checks their outputs . Prints ' Success ' if they satisfy all the test cases successfully else if they fail shows them their output and the expected output
def evaluate_code(testcases: List[Dict[str, str]], code_src: str):
    executable, extension = os.path.splitext(code_src)
    compile_code(executable, code_src)
    for testcase in testcases:
        print(
            f"Testing code for input: '{testcase.get('input').decode().rstrip()}' .....")
        curr_output = run_code(executable, testcase.get('input'))
        if curr_output == testcase.get('output'):
            print("Success!")
            print("")
        else:
            print(
                f"Failure!\nExpected Output: \n{testcase.get('output').decode()}\nActual Output: \n{curr_output.decode()}")
            print("")
def evaluate_code ( testcases : List [ Dict [ str , str ] ] , code_src : str ) : executable , extension = os . path . splitext ( code_src ) compile_code ( executable , code_src ) for testcase in testcases : print ( f"Testing code for input: '{testcase.get('input').decode().rstrip()}' ....." ) curr_output = run_code ( executable , testcase . get ( 'input' ) ) if curr_output == testcase . get ( 'output' ) : print ( "Success!" ) print ( "" ) else : print ( f"Failure!\nExpected Output: \n{testcase.get('output').decode()}\nActual Output: \n{curr_output.decode()}" ) print ( "" )
Runs the Lab codes against the correct code cases and then checks their outputs.
Runs the Lab codes against the correct code cases and then checks their outputs .
"""
    Runs the Lab codes against the correct code cases and then checks their outputs.
    Prints 'Success' if they satisfy all the test cases successfully else if they fail
    shows them their output and the expected output
    """
testcases
List[Dict[str, str]]
code_src
str