package tezt

  1. Overview
  2. Docs
Test framework for unit tests, integration tests, and regression tests

Install

Dune Dependency

Authors

Maintainers

Sources

tezt-3.1.0.tar.bz2
md5=d395cb9e663635ea8795f47c9bd9249f
sha512=d7c62899684ec202a98669eb575a2dc3bd1f8cf0430447c789a9d0aadc04a611d0dcfbcd7d61c613d4b7c78fd1bc4c533e4fcb48dbc8e3f19feaabe4ddd78723

doc/tezt.core/Tezt_core/Diff/index.html

Module Tezt_core.DiffSource

Compute the difference between two sequences of items.

Sourcetype item_report =
  1. | Kept of int * int
  2. | Added of int
  3. | Removed of int

Whether an item was kept, added or removed.

  • Kept carries (index_before, index_after).
  • Added carries index_after.
  • Removed carries index_before.
Sourcetype 'a t = {
  1. before : string;
  2. after : string;
  3. merged : (item_report * 'a) array;
  4. different : bool;
}

Difference reports.

before and after are the names of what was compared (e.g. filenames). They are used by log.

merged is such that filtering out Added items gives the items of before and filtering out Removed items gives the items of after.

different is true iff at least one item's report is not Kept.

Sourceval arrays : ?max_sync_distance:int -> ?equal:('a -> 'a -> bool) -> ?before:string -> ?after:string -> 'a array -> 'a array -> 'a t

Compute the difference between two arrays.

Usage: arrays a b

The algorithm compares items of a and b together with equal. When two items are different, the algorithm tries to find equal items later in a and b. max_sync_distance is the maximum distance after which it gives up. Increasing max_sync_distance gives more accurate results but increases the time taken quadratically.

before and after are stored in the result's before and after fields. Default values are "before" and "after" respectively.

Sourceval files : ?max_sync_distance:int -> ?before:string -> ?after:string -> string -> string -> string t

Compute the difference between two files.

Usage: files before_filename after_filename

Files are compared line by line.

before and after are stored in the result's before and after fields. Default values are before_filename and after_filename respectively.

Sourceval reduce_context : ?before:int -> ?after:int -> 'a t -> 'a t

Remove some Kept items.

Only keep at most before Kept items before Added and Removed items. Only keep at most after Kept items after Added and Removed items.

Default value for before and after is 3.

Sourceval output : (Log.Color.t option -> string -> unit) -> ('a -> string) -> 'a t -> unit

Output a diff if there are differences.

Usage: output output_line show_item diff

If diff.different is false, this does nothing. Else, it prints diff.before and diff.after, followed by diff.merged. Printing is done using output_line.

Sourceval log : ?level:Cli.log_level -> string t -> unit

Same as output using Log.log, for string diffs.

OCaml

Innovation. Community. Security.