package wire

  1. Overview
  2. Docs
Binary wire format DSL with EverParse 3D output

Install

dune-project
 Dependency

Authors

Maintainers

Sources

wire-1.1.0.tbz
sha256=b1310eabd9a945b38b3b4dc62f91986fd9d54ee2a006a65c8dcf8c36a61563ba
sha512=60a73a9f045079223b812863aea92ac7d3bffdc17b878ff9940301a93fb2f0f86f9c1a17999fdcd9f6647e13d0f53aef958e8d59c1ca42f84645e8809b39f1ce

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.

Sourcetype result =
  1. | Match
  2. | Both_failed
  3. | Value_mismatch of string
  4. | Only_c_ok of string
  5. | Only_ocaml_ok of string
Sourcetype t = {
  1. name : string;
  2. wire_size : int;
  3. test_read : string -> result;
  4. test_write : string -> result;
  5. test_roundtrip : string -> result;
}

A type-erased diff test.

Sourceval pp : Format.formatter -> t -> unit

Pretty-print a diff test summary.

Sourceval 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 -> t

harness ~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.