This repository has been archived on 2025-01-29. You can view files and clone it, but cannot push or open issues or pull requests.

22 lines
807 B
Python
Raw Normal View History

import os, sys, c, dataObjects
# load exercise and solution data in json format
cur_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
exercise_data_path = os.path.join(cur_dir, "examples", "exercise.json")
solution_data_path = os.path.join(cur_dir, "examples", "solution.json")
exercise_data = dataObjects.readJson(exercise_data_path)
solution_data = dataObjects.readJson(solution_data_path)
# create exercise and solution objects
exercise = dataObjects.Exercise(exercise_data)
solution = dataObjects.Solution(solution_data, exercise)
# optional configuration, e.g. for timeout during running
cfg = {"timelimitInSeconds": 15}
# create C module object, process data and store result data in json format
module = c.C(solution, cfg)
module.processData()
result = module.result.createJson()
print(result)