Examples for the Less Power programming exercise framework for OCaml. Each example showcases how a program exercise can be set up for automatic testing with LP. These examples are intended to showcase the Less Power project, but may also be adapted to create new programming exercises.
For running real programming courses, programming exercises derived from the examples in this repository are best run with Artemis. Artemis is an interactive learning platform that handles student participation and provides CI-based automated testing.
Each exercise is contained in a subdirectory of examples/
. Each programming exercise contains three subdirectories: template/
, solution/
, and tests/
.
-
Upon starting an exercise, the student should be given a copy of
template/
. It contains the minimal project setup for the student to start working on the exercise. -
The
solution/
is both a sample solution that can be shown to the student after the deadline, but also an important part of automated tests. Most automated tests compare against the sample solution to check for correctness. -
The tests themselves are contained in
tests/
.
Typically, each would live in a separate repository.
The examples depend on the Less Power framework being installed. LP is currently fixed to OCaml 5.1.1. Hence, from an OCaml 5.1.1. switch, LP can be installed using opam:
opam pin add less-power https://github.com/just-max/less-power.git#main
For trying out the examples and developing new exercises, the example exercises can be run locally:
-
Change into one of the
examples/nn-exercise/
directories. -
The test framework expects to find
assignment/
,solution/
, andtests/
directories (but does not directly use thetemplate/
directory). Create a symlink calledassignment/
to point to the "submission" being tested. For example, to run the tests against the template:ln --symbolic --no-target-directory --force template/ assignment
-
Start the testing process by running
tests/run.sh
. -
The results are printed to standard error, and saved to
test-reports/results.xml
. Withxmlstarlet
installed (debian:apt install xmlstarlet
), the scriptdump-test-reports.sh
pretty-prints the test results similar to how a student would see them.
During real courses, automated programming exercises are generally run with the help of a continuous integration service. With Artemis, the directory layout matches the one expected by the framework.
The examples contained within this repository are licensed under the BSD Zero Clause License, which should make it easy to adapt and reuse them as you see fit.