-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
open Dset | ||
|
||
let check ?(removed=[]) ?(added=[]) diff = | ||
List.for_all (fun x -> List.mem x added) diff.added && | ||
List.for_all (fun x -> List.mem x removed) diff.removed | ||
let check ?(right=[]) ?(left=[]) diff = | ||
List.for_all (fun x -> List.mem x left) diff.left_only && | ||
List.for_all (fun x -> List.mem x right) diff.right_only | ||
|
||
let e1 = element 1 and e2 = element 2 | ||
|
||
let () = | ||
assert (check (diff empty empty)); | ||
assert (check (diff (element 1) (element 2)) ~removed:[1] ~added:[2]); | ||
assert (check (diff (element 1) (element 1)) ~removed:[1] ~added:[1]); | ||
assert (check (diff (element 1) (element 2)) ~left:[1] ~right:[2]); | ||
assert (check (diff (element 1) (element 1)) ~left:[1] ~right:[1]); | ||
assert (check (diff e1 e1)); | ||
assert (check (diff e1 e2) ~removed:[1] ~added:[2]); | ||
assert (check (diff e2 e1) ~removed:[2] ~added:[1]); | ||
assert (check (diff e1 e2) ~left:[1] ~right:[2]); | ||
assert (check (diff e2 e1) ~left:[2] ~right:[1]); | ||
assert (check (diff e2 e2)); | ||
assert (check (diff (union e1 e1) (union e1 e1))); | ||
assert (check (diff (union e1 e2) (union e1 e1)) ~removed:[2]); | ||
assert (check (diff (union e1 e1) (union e1 e2)) ~added:[2]); | ||
assert (check (diff (union e1 e2) (union e1 e1)) ~left:[2]); | ||
assert (check (diff (union e1 e1) (union e1 e2)) ~right:[2]); | ||
assert (check (diff (union e1 e2) (union e1 e2))); | ||
assert (check (diff (union e1 e2) empty) ~removed:[2; 1]); | ||
assert (check (diff empty (union e1 e2)) ~added:[1; 2]); | ||
assert (check (diff (union e1 e2) empty) ~left:[2; 1]); | ||
assert (check (diff empty (union e1 e2)) ~right:[1; 2]); |