Exemplo n.º 1
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("without_st", "Testing task-maker", 1, 65536)
    interface.set_generator("generatore.py")
    interface.set_validator("valida.py")
    interface.add_solution("soluzione.py", 100, [100],
                           [(1, "Output is correct")] * 6)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("without_st", __file__)
Exemplo n.º 2
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("with_invalid_copy", "Testing task-maker", 1,
                              65536)
    interface.set_errors("Read where/am/i.txt: No such file or directory")
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_invalid_copy", __file__)
Exemplo n.º 3
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("communication", "Testing task-maker", 1, 65536)
    message = "A-ha, you're the best adding program I've ever met!"
    interface.add_solution("solution.c", 100, [100], [(1, message)] * 3)
    interface.add_solution("solution.cpp", 100, [100], [(1, message)] * 3)
    interface.add_solution("solution.pas", 100, [100], [(1, message)] * 3)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("communication", __file__)
Exemplo n.º 4
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("with_bugged_sol", "Testing task-maker", 1,
                              65536)
    interface.set_generator("generatore.py")
    interface.set_solution_errors("No buono")
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_bugged_sol", __file__)
Exemplo n.º 5
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests

if __name__ == "__main__":
    try:
        run_tests("tm_constraint_failed", __file__)
    except Exception as ex:
        assert "Constraint not met" in str(ex)
    else:
        raise ValueError("Constraint failed not thrown")
Exemplo n.º 6
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("tm", "Testing task-maker", 1, 65536)
    interface.add_solution("solution.py", 100, [5, 20, 20, 55], None)
    interface.add_solution("even.py", 20, [0, 20, 0, 0], None)
    interface.add_solution("odd.py", 20, [0, 0, 20, 0], None)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("tm", __file__)
Exemplo n.º 7
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TerryTestInterface
    interface = TerryTestInterface("terry_with_bugged_gen",
                                   "Testing task-maker", 100)
    interface.set_generator("generator.py")
    interface.set_validator("validator.py")
    interface.set_checker("checker.py")
    interface.expect_error("Failed to validate input")
    interface.run_checks()


if __name__ == "__main__":
    run_tests("terry_with_bugged_gen", __file__)
Exemplo n.º 8
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("with_bugged_checker", "Testing task-maker", 1,
                              65536)
    interface.set_generator("generatore.py")
    interface.set_checker_errors("signal 6")
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_bugged_checker", __file__)
Exemplo n.º 9
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("with_checker", "Testing task-maker", 1, 65536)
    interface.set_generator("generatore.py")
    interface.set_validator("valida.py")
    interface.add_solution("soluzione.sh", 100, [100], [(1, "Ok!")] * 6)
    interface.add_solution("wrong.sh", 0, [0], [(0, "Ko!")] * 6)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_checker", __file__)
Exemplo n.º 10
0
                           [(1, "Output is correct")] * 6)
    interface.add_solution("bash.sh", 100, [5, 45, 50],
                           [(1, "Output is correct")] * 6)
    interface.add_solution("float_error.cpp", 0, [0, 0, 0],
                           [(0, "signal 8")] * 6)
    interface.add_solution("mle.cpp", 0, [0, 0, 0])
    interface.add_solution("noop.py", 0, [0, 0, 0],
                           [(0, "Some files are missing")] * 6)
    interface.add_solution("nonzero.cpp", 0, [0, 0, 0],
                           [(0, "Exited with code 1")] * 6)
    interface.add_solution("sigsegv.c", 0, [0, 0, 0], [(0, "signal 11")] * 6)
    interface.add_solution("tle.cpp", 50, [5, 45, 0],
                           [(1, "Output is correct")] * 4 +
                           [(0, "Time limit exceeded")] * 2)
    interface.add_solution("wa.cpp", 0, [0, 0, 0],
                           [(0, "Output is not correct")] * 6)
    interface.add_solution("wrong_file.cpp", 0, [0, 0, 0],
                           [(0, "Some files are missing")] * 6)
    interface.add_solution("solution.rs", 100, [5, 45, 50],
                           [(1, "Output is correct")] * 6)

    def check_ignored(ui: IOIUIInterface):
        assert ".ignoreme.cpp" not in ui.solutions

    interface.set_callback(check_ignored)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_st", __file__)
Exemplo n.º 11
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests
from task_maker.uis.terry import TestcaseStatus


def test_task():
    from task_maker.tests.utils import TerryTestInterface

    interface = TerryTestInterface("terry_with_validator",
                                   "Testing task-maker", 100)
    interface.set_generator("generator.py")
    interface.set_validator("validator.py")
    interface.set_checker("checker.py")
    interface.add_solution("solution.py", 100, [TestcaseStatus.CORRECT] * 5)
    interface.add_solution("unordered.py", 100, [TestcaseStatus.CORRECT] * 5)
    interface.add_solution("wrong.py", 0, [TestcaseStatus.WRONG] * 5)
    interface.add_solution("missing.py", 0, [TestcaseStatus.MISSING] * 5)
    interface.add_solution("partial.py", 40, [
        TestcaseStatus.CORRECT, TestcaseStatus.CORRECT, TestcaseStatus.WRONG,
        TestcaseStatus.MISSING, TestcaseStatus.MISSING
    ])
    interface.run_checks()


if __name__ == "__main__":
    run_tests("terry_with_validator", __file__)
Exemplo n.º 12
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("without_gen", "Testing task-maker", 1, 65536)
    interface.add_solution("soluzione.cpp", 100, [100],
                           [(1, "Output is correct")] * 4)
    interface.add_solution("wa.cpp", 50, [50], [(1, "Output is correct")] * 2 +
                           [(0, "Output is not correct")] * 2)
    interface.add_solution("wrong_file.cpp", 0, [0],
                           [(0, "Output is not correct")] * 4)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("without_gen", __file__)
Exemplo n.º 13
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("with_bugged_gen", "Testing task-maker", 1,
                              65536)
    interface.set_generator("generatore.py")
    interface.set_generation_errors(":(")
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_bugged_gen", __file__)
Exemplo n.º 14
0
#!/usr/bin/env python3

from task_maker.tests.test import run_tests


def test_task():
    from task_maker.tests.utils import TestInterface
    interface = TestInterface("with_stdin", "Testing task-maker", 1, 65536)
    interface.set_generator("generatore.py")
    interface.set_validator("valida.py")
    interface.add_solution("soluzione.cpp", 100, [100],
                           [(1, "Output is correct")] * 4)
    interface.add_solution("noop.py", 0, [0],
                           [(0, "Output is not correct")] * 4)
    interface.add_solution("wa.cpp", 50, [50], [(1, "Output is correct")] * 2 +
                           [(0, "Output is not correct")] * 2)
    interface.add_solution("wrong_file.cpp", 0, [0],
                           [(0, "Output is not correct")] * 4)
    interface.run_checks()


if __name__ == "__main__":
    run_tests("with_stdin", __file__)