Skip to content

Commit

Permalink
Redefine List.equal
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Mar 7, 2024
1 parent bf96fad commit d76ebf1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/lib/test_contributions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ module Testable = struct
(Repo_map.pp (Format.pp_print_list Item.pp))
x.activity

(* [List.equal] requires OCaml >= 4.12 *)
let list_equal eq lx ly =
try
List.iter2 (fun x y -> if not (eq x y) then failwith "not equal") lx ly;
true
with _ -> false

let eq (x : t) (y : t) =
String.equal x.username y.username
&& Repo_map.eq (List.equal Item.eq) x.activity y.activity
&& Repo_map.eq (list_equal Item.eq) x.activity y.activity

let testable = Alcotest.testable pp eq
end
Expand Down

0 comments on commit d76ebf1

Please sign in to comment.