package ounit2
OUnit testing framework
Install
Dune Dependency
Authors
Maintainers
Sources
ounit-2.2.5.tbz
sha256=1b0d182b5eae536f37605f379b8e42a35d587471b917cee3d033bea20f7cbe55
sha512=2e519ff032843298b4dd716d7b3460d4720fe59ba1535a32fc9ef58eae4fcc80d3ec59ddb7b22653f064ef8ae02d19ae1afd2ed7de16c34d396ea180a6e33cb1
doc/ounit2.advanced/OUnitDiff/index.html
Module OUnitDiff
Source
Unit tests for collection of elements
This module allows to define a more precise way to display differences between collection of elements. When collection differ, the tester is interested by what are the missing/extra elements. This module provides a diff
operation to spot the difference quickly between two sets of elements.
Example:
open OUnit;;
module EInt =
struct
type t = int
let compare = ( - )
let pp_printer = Format.pp_print_int
let pp_print_sep = OUnitDiff.pp_comma_separator
end
module ListInt = OUnitDiff.ListSimpleMake(EInt);;
let test_diff () =
ListInt.assert_equal
[1; 2; 3; 4; 5]
[1; 2; 5; 4]
;;
let _ =
run_test_tt_main ("test_diff" >:: test_diff)
;;
when run this test outputs:
OUnit: expected: 1, 2, 3, 4, 5 but got: 1, 2, 5, 4
differences: element number 2 differ (3 <> 5)
Signatures
Definition of an element
Implementations
Collection of elements based on a Set, elements order doesn't matter
Collection of elements based on a List, order matters but difference display is very simple. It stops at the first element which differs.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page