Skip to content

Commit

Permalink
Merge pull request #491 from ocaml-multicore/require-qcheck-0-23
Browse files Browse the repository at this point in the history
Require qcheck-core.0.23
  • Loading branch information
jmid authored Dec 13, 2024
2 parents f5f284f + 2684c1b commit 1965542
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: c-cube/qcheck
ref: v0.22
ref: v0.23
path: multicoretests/qcheck

- name: Pre-Setup
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next release

- #491: Require `qcheck.0.23`, simplify show functions by utilizing it, and update
expect outputs accordingly
- #486: Add `Util.Pp.pp_fun_` printer for generated `QCheck.fun_` functions

## 0.4
Expand Down
8 changes: 4 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ the multicore run-time of OCaml 5.0.")
(tags ("test" "test suite" "property" "qcheck" "quickcheck" "multicore" "non-determinism"))
(depends
base-domains
(qcheck-core (>= "0.20"))
(qcheck-core (>= "0.23"))
(qcheck-lin (= :version))
(qcheck-stm (= :version))))

Expand All @@ -31,7 +31,7 @@ sequential and parallel tests against a declarative model.")
(depopts base-domains)
(depends
(ocaml (>= 4.12))
(qcheck-core (>= "0.20"))
(qcheck-core (>= "0.23"))
(qcheck-multicoretests-util (= :version))))

(package
Expand All @@ -46,7 +46,7 @@ and explained by some sequential interleaving.")
(depopts base-domains)
(depends
(ocaml (>= 4.12))
(qcheck-core (>= "0.20"))
(qcheck-core (>= "0.23"))
(qcheck-multicoretests-util (= :version))))

(package
Expand All @@ -57,4 +57,4 @@ multicore programs.")
(tags ("test" "property" "qcheck" "quickcheck" "multicore" "non-determinism"))
(depends
(ocaml (>= 4.12))
(qcheck-core (>= "0.20"))))
(qcheck-core (>= "0.23"))))
14 changes: 7 additions & 7 deletions lib/STM.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ type _ ty +=

type 'a ty_show = 'a ty * ('a -> string)

let unit = (Unit, fun () -> "()")
let bool = (Bool, string_of_bool)
let char = (Char, fun c -> Printf.sprintf "%C" c)
let int = (Int, string_of_int)
let unit = (Unit, QCheck.Print.unit)
let bool = (Bool, QCheck.Print.bool)
let char = (Char, QCheck.Print.char)
let int = (Int, QCheck.Print.int)
let int32 = (Int32, Int32.to_string)
let int64 = (Int64, Int64.to_string)
let float = (Float, Float.to_string)
let string = (String, fun s -> Printf.sprintf "%S" s)
let bytes = (Bytes, fun b -> Printf.sprintf "%S" (Bytes.to_string b))
let float = (Float, QCheck.Print.float)
let string = (String, QCheck.Print.string)
let bytes = (Bytes, QCheck.Print.bytes)
let option spec =
let (ty,show) = spec in
(Option ty, QCheck.Print.option show)
Expand Down
22 changes: 9 additions & 13 deletions lib/lin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,12 @@ let gen_deconstructible gen print eq = GenDeconstr (gen,print,eq)

let qcheck_nat64_small = QCheck.(map Int64.of_int small_nat)

let print_char c = Printf.sprintf "%C" c
let print_string s = Printf.sprintf "%S" s
let print_bytes b = print_string (Bytes.to_string b)

let bytes_small_printable = QCheck.bytes_small_of QCheck.Gen.printable

let unit = GenDeconstr (QCheck.unit, QCheck.Print.unit, (=))
let bool = GenDeconstr (QCheck.bool, QCheck.Print.bool, (=))
let char = GenDeconstr (QCheck.char, print_char, (=))
let char_printable = GenDeconstr (QCheck.printable_char, print_char, (=))
let char = GenDeconstr (QCheck.char, QCheck.Print.char, (=))
let char_printable = GenDeconstr (QCheck.printable_char, QCheck.Print.char, (=))
let nat_small = GenDeconstr (QCheck.small_nat, QCheck.Print.int, (=))
let int = GenDeconstr (QCheck.int, QCheck.Print.int, (=))
let int_small = GenDeconstr (QCheck.small_int, QCheck.Print.int, (=))
Expand All @@ -173,13 +169,13 @@ let int_bound b = GenDeconstr (QCheck.int_bound b, QCheck.Print.int, (=))
let int32 = GenDeconstr (QCheck.int32, Int32.to_string, Int32.equal)
let int64 = GenDeconstr (QCheck.int64, Int64.to_string, Int64.equal)
let nat64_small = GenDeconstr (qcheck_nat64_small, Int64.to_string, Int64.equal)
let float = GenDeconstr (QCheck.float, Float.to_string, Float.equal)
let string = GenDeconstr (QCheck.string, print_string, String.equal)
let string_small = GenDeconstr (QCheck.small_string, print_string, String.equal)
let string_small_printable = GenDeconstr (QCheck.small_printable_string, print_string, String.equal)
let bytes = GenDeconstr (QCheck.bytes, print_bytes, Bytes.equal)
let bytes_small = GenDeconstr (QCheck.bytes_small, print_bytes, Bytes.equal)
let bytes_small_printable = GenDeconstr (bytes_small_printable, print_bytes, Bytes.equal)
let float = GenDeconstr (QCheck.float, QCheck.Print.float, Float.equal)
let string = GenDeconstr (QCheck.string, QCheck.Print.string, String.equal)
let string_small = GenDeconstr (QCheck.small_string, QCheck.Print.string, String.equal)
let string_small_printable = GenDeconstr (QCheck.small_printable_string, QCheck.Print.string, String.equal)
let bytes = GenDeconstr (QCheck.bytes, QCheck.Print.bytes, Bytes.equal)
let bytes_small = GenDeconstr (QCheck.bytes_small, QCheck.Print.bytes, Bytes.equal)
let bytes_small_printable = GenDeconstr (bytes_small_printable, QCheck.Print.bytes, Bytes.equal)

let option : type a c s. ?ratio:float -> (a, c, s, combinable) ty -> (a option, c, s, combinable) ty =
fun ?ratio ty ->
Expand Down
2 changes: 1 addition & 1 deletion multicoretests.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues"
depends: [
"dune" {>= "3.0"}
"base-domains"
"qcheck-core" {>= "0.20"}
"qcheck-core" {>= "0.23"}
"qcheck-lin" {= version}
"qcheck-stm" {= version}
"odoc" {with-doc}
Expand Down
2 changes: 1 addition & 1 deletion qcheck-lin.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.12"}
"qcheck-core" {>= "0.20"}
"qcheck-core" {>= "0.23"}
"qcheck-multicoretests-util" {= version}
"odoc" {with-doc}
]
Expand Down
2 changes: 1 addition & 1 deletion qcheck-multicoretests-util.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.12"}
"qcheck-core" {>= "0.20"}
"qcheck-core" {>= "0.23"}
"odoc" {with-doc}
]
build: [
Expand Down
2 changes: 1 addition & 1 deletion qcheck-stm.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.12"}
"qcheck-core" {>= "0.20"}
"qcheck-core" {>= "0.23"}
"qcheck-multicoretests-util" {= version}
"odoc" {with-doc}
]
Expand Down
2 changes: 1 addition & 1 deletion test/util_pp.expected
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ Test of pp_record:
{ key = 123; value = "content" }

Test of pp_fun_:
{(Some (-123456), a, xyz) -> true; (None, b, ) -> true; _ -> true}
{(Some (-123456), 'a', "xyz") -> true; (None, 'b', "") -> true; _ -> true}

2 changes: 1 addition & 1 deletion test/util_pp_trunc150.expected
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ Test of pp_record:
{ key = 123; value = "content" }

Test of pp_fun_:
{(Some (-123456), a, xyz) -> true; (None, b, ) -> true; _ -> true}
{(Some (-123456), 'a', "xyz") -> true; (None, 'b', "") -> true; _ -> true}

2 changes: 1 addition & 1 deletion test/util_pp_trunc79.expected
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ Test of pp_record:
{ key = 123; value = "content" }

Test of pp_fun_:
{(Some (-123456), a, xyz) -> true; (None, b, ) -> true; _ -> true}
{(Some (-123456), 'a', "xyz") -> true; (None, 'b', "") -> true; _ -> true}

0 comments on commit 1965542

Please sign in to comment.