package wire
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=323f48e6cb897fe48aac558b09bb25134d3b19fec37b20d7930eec15f387c238
sha512=00c77f8672396ab15d993602db9bab95d2478ace1f569606f0140ed25d7ff852525e53436d95e5061442a6ea8b5650549239c68ef861b4b921b4a53faac97eb7
doc/wire.diff/Wire_diff/index.html
Module Wire_diffSource
Differential testing: one Wire.Codec.t against external C behaviour.
A diff test keeps the codec as the single OCaml authority and compares it against C read/write functions, typically backed by EverParse-generated code.
type t = {name : string;wire_size : int;test_read : string -> result;test_write : string -> result;test_roundtrip : string -> result;
}A type-erased diff test.
Pretty-print a diff test summary.
val harness :
name:string ->
codec:'r Wire.Codec.t ->
read:(string -> 'a option) ->
write:('a -> string option) ->
project:('r -> 'a) ->
equal:('a -> 'a -> bool) ->
?ocaml_read:(string -> 'a option) ->
unit ->
tharness ~name ~codec ~read ~write ~project ~equal ?ocaml_read () creates a diff test comparing an OCaml codec against external read/write functions.
The test compares both implementations in a single semantic domain 'a: project maps OCaml-decoded values into that domain, read extracts an external value from wire bytes, and write serializes a value in that same domain back to wire bytes. ocaml_read, when provided, overrides the default OCaml byte-reading path derived from codec and project.