frenetic-lang/ocaml-openflow — pull request #6 by seliopou (2013-10-14 23:02:32+00:00)
Title: RoundTrip testing Using QuickCheck

Implement roundtrip testing using QuickCheck for the following modules:

* OF0x01.Match
* OF0x01.PseudoPort
* OF0x01.Action
* OF0x01.FlowMod.Command
* OF0x01.FlowMod.Timeout
* OF0x01.Flowmod

This pull request had to modify all their public APIs to expose the `marshal` and `parse` functions—though they're sometimes called something else—as well as any other necessary functions to perform roundtrip testing. This pull request also introduces several interfaces that are useful for setting up these tests:

* `OpenFlow0x01_Arbitrary`: requires a `marshal`, `parse`, and `to_string` function on the data type, and you also must specify the serialization type for the types to work out.
* `OpenFlow0x01_ArbitraryCstruct`: assumes the serialized type is a `Cstruct`, and therefore also requires a `size_of` function; and
* `OpenFlow0x01_Unsize`: a functor to convert the latter module to the former.

I only found one bug throughout testing, which I fixed in 092b7fd05e5c47acd957a12e84d1715e3b61a639.