Documentation ¶
Overview ¶
Module provides structures and functions for managing and executing modules, which consist of multiple exercises. The package includes features for setting up environments, running exercises in isolated containers, and grading the results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GradingConfig ¶ added in v0.2.0
type Module ¶
type Module struct { Name string // Name is the module's display name. MinimumGrade int // MinimumGrade is the minimum score required to pass the module. Exercises map[string]Exercise.Exercise // Exercises is a map of all exercises belonging to the module. SubjectPath string // SubjectPath is the path to the module's subject file (markdown or html). DockerImageName string // Name of the docker image containing the environment for grading this module. }
Module represents a module containing multiple exercises. It includes the module's name, the minimum grade required to pass, a map of exercises, the path to the subject file and the name of the Docker image which is to be used to run the code in.
func NewModule ¶
func NewModule(name string, minimumGrade int, exercises map[string]Exercise.Exercise, subjectPath string, dockerImageName string) (module Module)
NewModule initializes and returns a Module struct.
- name: module display name
- minimumGrade: the minimum score required to pass the module
- exercises: map of all Exercise.Exercise objects belonging to the module
- subjectPath: path to the module's subject file
func (*Module) GetScore ¶
GetScore calculates the total score based on the results of the exercises and determines if the module is passed.
- results: a map of exercise names to their pass/fail results
Returns the total score and a boolean indicating whether the module is passed.
func (*Module) Run ¶
Run executes the exercises, spawning a Docker container for each of them to prevent running malicious code on your machine. It returns the results and the path to the trace logs.
- repoID: the ID of the repository to be cloned
- testDirectory: the directory where the repository will be cloned
Returns a map of exercise names to their pass/fail results and the path to the trace logs.