Hi! I’m working on a tool, Mica, which automates differential testing for two OCaml modules implementing the same signature (e.g. finite sets implemented using lists & AVL trees respectively). Specifically, Mica uses QuickCheck to test if two modules are observationally equivalent.
We demo’ed Mica at the ICFP '23 Student Research Competition (poster), and we’re now hoping to try out a new version of Mica on modules taken from real-world OCaml code.
If you know of real-world examples where the same module signature is implemented differently across different modules, please comment below! Alternatively, if you know of pairs of OCaml libraries that have roughly the same functionality (e.g. Yojson & Ezjsonm both provide similar JSON-handling functionality), that also works!
We’re hoping to compile a list of modules/libraries that have roughly the same functionality, such as:
In dolmen I have a custom implementation of maps of strings using a trie (inspired by this paper). These can easily be compared to the maps from the stdlib.
More specifically:
I define a common reduced interface for maps here (note that this lacks quite a few common functions, such as remove that I don’t use in that project for now)
Thank you all, much appreciated! These are all great examples – I think @zozozo’s Map implementation might be the easiest to test using our tool but I’ll also try the other!
Thanks Jeremy! That reminds me, I should also look at your ocaml-integers library and see how it compares to Int32 / Int64 modules in the standard library.
Another one to consider: safe-string-buffer closely follows the interface of the standard library Buffer module, but uses a different representation (a list of immutable string values rather than a single mutable bytes array).