docs icon indicating copy to clipboard operation
docs copied to clipboard

Recipe: OCaml test suite

Open hobovsky opened this issue 3 years ago • 2 comments

Use material collected when working on https://github.com/codewars/ocaml/issues/1 and https://github.com/codewars/ocaml/pull/2 and prepare a guide similar to other language specific authoring guides, like for example the one for Javascript.

Example kumite: https://www.codewars.com/kumite/620a7361d746e5000f36a021/

Features:

  • TestLists, with and without labels
  • TestCases, with and without labels
  • Nested tests
  • Nested labels
  • Custom assertion messages and printers

hobovsky avatar Feb 15 '22 23:02 hobovsky

Here is an example of a test suite using the optional pp_diff argument of assert_equal : https://www.codewars.com/kumite/62ff92cb211df8001c4b80c4

This argument is used to show the differences between the expected and actual answers in a custom way.

Glinat avatar Aug 21 '22 20:08 Glinat

When working with lists, ~pp_diff and ~printer can be automatically generated with the OUnitDiff module, as demonstrated in its documentation.

Glinat avatar Aug 21 '22 21:08 Glinat