Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/opam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
strategy:
matrix:
ocaml-compiler:
- 4.13.x
- 4.14.x
- 5.0.0
- ocaml-variants.5.1.0+trunk
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ and explained by some sequential interleaving.")
(tags ("test" "property" "qcheck" "quickcheck" "parallelism" "sequential consistency"))
(depopts base-domains)
(depends
(ocaml (>= 4.14))
(ocaml (>= 4.13))
(qcheck-core (>= "0.20"))
(qcheck-multicoretests-util (= :version))
(ppx_deriving (and :with-test (>= "5.2.1")))))
Expand Down
16 changes: 13 additions & 3 deletions lib/lin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,13 @@ let array : type a c s. (a, c, s, combinable) ty -> (a array, c, s, combinable)
| GenDeconstr (arb, print, eq) -> GenDeconstr (QCheck.array arb, QCheck.Print.array print, Array.for_all2 eq)
| Deconstr (print, eq) -> Deconstr (QCheck.Print.array print, Array.for_all2 eq)

let seq_iteri f s =
let (_:int) = Seq.fold_left (fun i x -> f i x; i + 1) 0 s in ()

let print_seq pp s =
let b = Buffer.create 25 in
Buffer.add_char b '<';
Seq.iteri (fun i x ->
seq_iteri (fun i x ->
if i > 0 then Buffer.add_string b "; ";
Buffer.add_string b (pp x))
s;
Expand All @@ -215,11 +218,18 @@ let arb_seq a =
let gen = Gen.map List.to_seq (Gen.list a.gen) in
QCheck.make ?print ~shrink gen

let rec seq_equal eq s1 s2 =
let open Seq in
match s1 (), s2 () with
| Nil, Nil -> true
| Cons (a, an), Cons (b, bn) when eq a b -> seq_equal eq an bn
| _ -> false

let seq : type a c s. (a, c, s, combinable) ty -> (a Seq.t, c, s, combinable) ty =
fun ty -> match ty with
| Gen (arb, print) -> Gen (arb_seq arb, print_seq print)
| GenDeconstr (arb, print, eq) -> GenDeconstr (arb_seq arb, print_seq print, Seq.equal eq)
| Deconstr (print, eq) -> Deconstr (print_seq print, Seq.equal eq)
| GenDeconstr (arb, print, eq) -> GenDeconstr (arb_seq arb, print_seq print, seq_equal eq)
| Deconstr (print, eq) -> Deconstr (print_seq print, seq_equal eq)

let state = State
let t = state
Expand Down
2 changes: 1 addition & 1 deletion qcheck-lin.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ homepage: "https://github.com/ocaml-multicore/multicoretests"
bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.14"}
"ocaml" {>= "4.13"}
"qcheck-core" {>= "0.20"}
"qcheck-multicoretests-util" {= version}
"ppx_deriving" {with-test & >= "5.2.1"}
Expand Down