cmsc330spring18-public icon indicating copy to clipboard operation
cmsc330spring18-public copied to clipboard

Use `qcheck` library to test student code

Open Isweet opened this issue 7 years ago • 0 comments

Just leaving this here as a suggestion for investigation.

The qcheck is a QuickCheck-like library for OCaml. It can be used to define property-based tests easily.

The documentation gives an example of a test that checks that List.rev is involutive. In addition, the library provides an easy way to convert a qcheck test into an OUnit test.

In addition to abstract algebraic properties, you could also specify operational properties like:

let oracle_elem x l =
  elem x l = Oracle.elem x l

which says that the student implementation of elem agrees with Oracle.elem on all inputs (where Oracle.elem is the instructor solution).

Isweet avatar Oct 03 '18 19:10 Isweet