Skip to content

Commit

Permalink
test: avoid the deprecated small_int
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed Oct 19, 2023
1 parent abe9c7b commit 9930253
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test/ListAsBwdLabels.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let nth xs i =

let nth_opt xs i =
try L.nth_opt (L.rev xs) i with
| Invalid_argument _ -> invalid_arg "Bwd.nth"
| Invalid_argument _ -> invalid_arg "Bwd.nth_opt"

let append xs ys = xs @ ys

Expand Down
14 changes: 7 additions & 7 deletions test/TestBwdLabels.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ let test_compare_lengths =
(fun (xs, ys) -> B.compare_lengths (of_list xs) (of_list ys) = L.compare_lengths xs ys)
let test_compare_length_with =
Q.Test.make ~count ~name:"compare_length_with"
Q.Gen.(pair (small_list unit) (small_int))
Q.Gen.(pair (small_list unit) (small_signed_int))
~print:Q.Print.(pair (list unit) int)
(fun (xs, len) -> B.compare_length_with (of_list xs) ~len = L.compare_length_with xs ~len)
let test_snoc =
Q.Test.make ~count ~name:"snoc" Q.Gen.(pair (small_list int) int) ~print:Q.Print.(pair (list int) int)
(fun (xs, x) -> to_list (B.snoc (of_list xs) x) = L.snoc xs x)
let test_nth =
Q.Test.make ~count ~name:"nth"
Q.Gen.(pair (small_list int) small_int)
Q.Gen.(pair (small_list int) small_signed_int)
~print:Q.Print.(pair (list int) int)
(fun (xs, i) ->
trap (fun () -> B.nth (of_list xs) i)
=
trap (fun () -> L.nth xs i))
let test_nth_opt =
Q.Test.make ~count ~name:"nth_opt"
Q.Gen.(pair (small_list int) small_int)
Q.Gen.(pair (small_list int) small_signed_int)
~print:Q.Print.(pair (list int) int)
(fun (xs, i) ->
trap (fun () -> B.nth_opt (of_list xs) i)
Expand All @@ -63,12 +63,12 @@ let test_prepend =
(fun (xs, ys) -> B.prepend (of_list xs) ys = L.prepend xs ys)
let test_equal =
Q.Test.make ~count ~name:"equal"
Q.Gen.(triple (Q.fun2 Q.Observable.int Q.Observable.int bool) (small_list small_int) (small_list small_int))
Q.Gen.(triple (Q.fun2 Q.Observable.int Q.Observable.int bool) (small_list small_nat) (small_list small_nat))
~print:Q.Print.(triple Q.Fn.print (list int) (list int))
(fun (Fun (_, eq), xs, ys) -> B.equal ~eq (of_list xs) (of_list ys) = L.equal ~eq xs ys)
let test_compare =
Q.Test.make ~count ~name:"compare"
Q.Gen.(triple (Q.fun2 Q.Observable.int Q.Observable.int int) (small_list small_int) (small_list small_int))
Q.Gen.(triple (Q.fun2 Q.Observable.int Q.Observable.int int) (small_list small_nat) (small_list small_nat))
~print:Q.Print.(triple Q.Fn.print (list int) (list int))
(fun (Fun (_, cmp), xs, ys) -> B.compare ~cmp (of_list xs) (of_list ys) = L.compare ~cmp xs ys)
let test_iter =
Expand Down Expand Up @@ -185,12 +185,12 @@ let test_exists2 =
trap (fun () -> L.exists2 ~f xs ys))
let test_mem =
Q.Test.make ~count ~name:"mem"
Q.Gen.(pair small_int (small_list small_int))
Q.Gen.(pair small_nat (small_list small_nat))
~print:Q.Print.(pair int (list int))
(fun (a, set) -> B.mem a ~set:(of_list set) = L.mem a ~set)
let test_memq =
Q.Test.make ~count ~name:"memq"
Q.Gen.(pair (opt small_int) (small_list (opt small_int))) (* use [int option] to test physical equality *)
Q.Gen.(pair (opt small_nat) (small_list (opt small_nat))) (* use [int option] to test physical equality *)
~print:Q.Print.(pair (option int) (list (option int)))
(fun (a, set) -> B.memq a ~set:(of_list set) = L.memq a ~set)
let test_find =
Expand Down

0 comments on commit 9930253

Please sign in to comment.