Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ocaml-qcheck for openSUSE:Factory 
checked in at 2022-04-06 21:51:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ocaml-qcheck (Old)
 and      /work/SRC/openSUSE:Factory/.ocaml-qcheck.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ocaml-qcheck"

Wed Apr  6 21:51:26 2022 rev:9 rq:967078 version:0.18.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ocaml-qcheck/ocaml-qcheck.changes        
2021-09-29 20:19:41.491056080 +0200
+++ /work/SRC/openSUSE:Factory/.ocaml-qcheck.new.1900/ocaml-qcheck.changes      
2022-04-06 21:51:47.407362638 +0200
@@ -1,0 +2,6 @@
+Mon Apr  4 04:04:04 UTC 2022 - oher...@suse.de
+
+- Update to version 0.18.1
+  See included CHANGELOG.md for details
+
+-------------------------------------------------------------------

Old:
----
  ocaml-qcheck-0.18.tar.xz

New:
----
  ocaml-qcheck-0.18.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ocaml-qcheck.spec ++++++
--- /var/tmp/diff_new_pack.sRtfGF/_old  2022-04-06 21:51:47.883357206 +0200
+++ /var/tmp/diff_new_pack.sRtfGF/_new  2022-04-06 21:51:47.891357115 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ocaml-qcheck
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,34 +17,34 @@
 
 
 %bcond_with ocaml_qcheck_testsuite
-%define build_flavor @BUILD_FLAVOR@%{nil}
-%if "%{build_flavor}" == "testsuite"
+%define build_flavor @BUILD_FLAVOR@%nil
+%if "%build_flavor" == "testsuite"
 %if %{without ocaml_qcheck_testsuite}
 ExclusiveArch:  do-not-build
 %endif
 %define nsuffix -testsuite
 %else
-%define nsuffix %{nil}
+%define nsuffix %nil
 %endif
 
 %define     pkg ocaml-qcheck
-Name:           %{pkg}%{nsuffix}
-Version:        0.18
+Name:           %pkg%nsuffix
+Version:        0.18.1
 Release:        0
 %{?ocaml_preserve_bytecode}
 Summary:        QuickCheck inspired property-based testing for OCaml
 License:        BSD-2-Clause
 Group:          Development/Languages/OCaml
 URL:            https://opam.ocaml.org/packages/qcheck
-Source0:        %{pkg}-%{version}.tar.xz
+Source0:        %pkg-%version.tar.xz
 BuildRequires:  ocaml(ocaml_base_version) >= 4.08
 BuildRequires:  ocaml-dune >= 2.2
-BuildRequires:  ocaml-rpm-macros >= 20210911
+BuildRequires:  ocaml-rpm-macros >= 20220222
 BuildRequires:  ocamlfind(bytes)
 BuildRequires:  ocamlfind(ounit2)
 BuildRequires:  ocamlfind(unix)
 
-%if "%{build_flavor}" == "testsuite"
+%if "%build_flavor" == "testsuite"
 BuildRequires:  ocamlfind(alcotest)
 BuildRequires:  ocamlfind(qcheck)
 %endif
@@ -55,35 +55,35 @@
 generating instances and printing them.
 
 %package        devel
-Summary:        Development files for %{name}
+Summary:        Development files for %name
 Group:          Development/Languages/OCaml
-Requires:       %{name} = %{version}
+Requires:       %name = %version
 
 %description    devel
-The %{name}-devel package contains libraries and signature files for
-developing applications that use %{name}.
+The %name-devel package contains libraries and signature files for
+developing applications that use %name.
 
 
 %prep
-%autosetup -p1 -n %{pkg}-%{version}
+%autosetup -p1 -n %pkg-%version
 
 %build
 dune_release_pkgs='qcheck,qcheck-core,qcheck-ounit'
-%if "%{build_flavor}" == "testsuite"
+%if "%build_flavor" == "testsuite"
 dune_release_pkgs="${dune_release_pkgs},qcheck-alcotest"
 %endif
 %ocaml_dune_setup
-%if "%{build_flavor}" == ""
+%if "%build_flavor" == ""
 %ocaml_dune_build
 %endif
 
 %install
-%if "%{build_flavor}" == ""
+%if "%build_flavor" == ""
 %ocaml_dune_install
 %ocaml_create_file_list
 %endif
 
-%if "%{build_flavor}" == "testsuite"
+%if "%build_flavor" == "testsuite"
 %check
 %if "%_lib" == "lib"
 : https://github.com/c-cube/qcheck/issues/152
@@ -92,11 +92,11 @@
 %endif
 %endif
 
-%if "%{build_flavor}" == ""
-%files -f %{name}.files
+%if "%build_flavor" == ""
+%files -f %name.files
 %doc README.adoc
 
-%files devel -f %{name}.files.devel
+%files devel -f %name.files.devel
 %endif
 
 %changelog

++++++ _service ++++++
--- /var/tmp/diff_new_pack.sRtfGF/_old  2022-04-06 21:51:47.931356659 +0200
+++ /var/tmp/diff_new_pack.sRtfGF/_new  2022-04-06 21:51:47.931356659 +0200
@@ -1,7 +1,7 @@
 <services>
   <service name="tar_scm" mode="disabled">
     <param name="filename">ocaml-qcheck</param>
-    <param name="revision">b065a81661d312fc7bbdbf95fb24229d71991a10</param>
+    <param name="revision">7bc126593ecc06d71d076b4caca06ce7bc380d56</param>
     <param name="scm">git</param>
     <param name="submodules">disable</param>
     <param name="url">https://github.com/c-cube/qcheck.git</param>

++++++ ocaml-qcheck-0.18.tar.xz -> ocaml-qcheck-0.18.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/AUTHORS 
new/ocaml-qcheck-0.18.1/AUTHORS
--- old/ocaml-qcheck-0.18/AUTHORS       2021-09-10 17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/AUTHORS     2022-02-03 16:20:08.000000000 +0100
@@ -2,3 +2,4 @@
 Rudi Grinberg <rudi.grinb...@gmail.com>
 Jacques-Pascal Deplaix <jp.depl...@gmail.com>
 Jan Midtgaard <m...@janmidtgaard.dk>
+Valentin Chaboche <valentin....@gmail.com>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/CHANGELOG.md 
new/ocaml-qcheck-0.18.1/CHANGELOG.md
--- old/ocaml-qcheck-0.18/CHANGELOG.md  2021-09-10 17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/CHANGELOG.md        2022-02-03 16:20:08.000000000 
+0100
@@ -1,5 +1,10 @@
 # Changes
 
+## 0.18.1
+
+- fix `Gen.{nat,pos}_split{2,}`
+- fix stack overflow in #156
+
 ## 0.18
 
 This releases marks the addition of `QCheck2`, a module where generation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/README.adoc 
new/ocaml-qcheck-0.18.1/README.adoc
--- old/ocaml-qcheck-0.18/README.adoc   2021-09-10 17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/README.adoc 2022-02-03 16:20:08.000000000 +0100
@@ -402,6 +402,18 @@
 
 ----
 
+=== Deriver
+
+A ppx_deriver is provided to derive QCheck generators from a type declaration.
+
+```ocaml
+type tree = Leaf of int | Node of tree * tree
+[@@deriving qcheck]
+```
+
+See the according 
https://github.com/c-cube/qcheck/tree/master/src/ppx_deriving_qcheck/[README]
+for more information and examples.
+
 === Compatibility notes
 
 Starting with 0.9, the library is split into several components:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ocaml-qcheck-0.18/example/alcotest/output.txt.expected 
new/ocaml-qcheck-0.18.1/example/alcotest/output.txt.expected
--- old/ocaml-qcheck-0.18/example/alcotest/output.txt.expected  2021-09-10 
17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/example/alcotest/output.txt.expected        
2022-02-03 16:20:08.000000000 +0100
@@ -1,22 +1,14 @@
 qcheck random seed: 1234
 Testing `my test'.
-
   [OK]          suite          0   list_rev_is_involutive.
 > [FAIL]        suite          1   fail_sort_id.
   [FAIL]        suite          2   error_raise_exn.
   [FAIL]        suite          3   fail_check_err_message.
   [OK]          suite          4   tree_rev_is_involutive.
-
 
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
 ??? [FAIL]        suite          1   fail_sort_id.                             
  ???
 
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
-
 test `fail_sort_id` failed on ??? 1 cases: [1; 0] (after 20 shrink steps)
-                                           
 [exception] test `fail_sort_id` failed on ??? 1 cases: [1; 0] (after 20 shrink 
steps)
-                                           
-            
-
  
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
-
 3 failures! 5 tests run.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/example/alcotest/run_alcotest.sh 
new/ocaml-qcheck-0.18.1/example/alcotest/run_alcotest.sh
--- old/ocaml-qcheck-0.18/example/alcotest/run_alcotest.sh      2021-09-10 
17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/example/alcotest/run_alcotest.sh    2022-02-03 
16:20:08.000000000 +0100
@@ -11,5 +11,7 @@
   | grep -v 'Logs saved to' \
   | grep -v 'Raised at ' \
   | grep -v 'Called from ' \
-  | sed 's/! in .*s\./!/'
+  | sed 's/! in .*s\./!/' \
+  | sed 's/[ \t]*$//g' \
+  | tr -s "\n"
 exit $CODE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/qcheck-alcotest.opam 
new/ocaml-qcheck-0.18.1/qcheck-alcotest.opam
--- old/ocaml-qcheck-0.18/qcheck-alcotest.opam  2021-09-10 17:43:20.000000000 
+0200
+++ new/ocaml-qcheck-0.18.1/qcheck-alcotest.opam        2022-02-03 
16:20:08.000000000 +0100
@@ -5,7 +5,7 @@
 license: "BSD-2-Clause"
 synopsis: "Alcotest backend for qcheck"
 doc: ["http://c-cube.github.io/qcheck/";]
-version: "0.18"
+version: "0.18.1"
 tags: [
   "test"
   "quickcheck"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/qcheck-core.opam 
new/ocaml-qcheck-0.18.1/qcheck-core.opam
--- old/ocaml-qcheck-0.18/qcheck-core.opam      2021-09-10 17:43:20.000000000 
+0200
+++ new/ocaml-qcheck-0.18.1/qcheck-core.opam    2022-02-03 16:20:08.000000000 
+0100
@@ -5,7 +5,7 @@
 license: "BSD-2-Clause"
 synopsis: "Core qcheck library"
 doc: ["http://c-cube.github.io/qcheck/";]
-version: "0.18"
+version: "0.18.1"
 tags: [
   "test"
   "property"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/qcheck-ounit.opam 
new/ocaml-qcheck-0.18.1/qcheck-ounit.opam
--- old/ocaml-qcheck-0.18/qcheck-ounit.opam     2021-09-10 17:43:20.000000000 
+0200
+++ new/ocaml-qcheck-0.18.1/qcheck-ounit.opam   2022-02-03 16:20:08.000000000 
+0100
@@ -5,7 +5,7 @@
 homepage: "https://github.com/c-cube/qcheck/";
 doc: ["http://c-cube.github.io/qcheck/";]
 synopsis: "OUnit backend for qcheck"
-version: "0.18"
+version: "0.18.1"
 tags: [
   "qcheck"
   "quickcheck"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/qcheck.opam 
new/ocaml-qcheck-0.18.1/qcheck.opam
--- old/ocaml-qcheck-0.18/qcheck.opam   2021-09-10 17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/qcheck.opam 2022-02-03 16:20:08.000000000 +0100
@@ -5,7 +5,7 @@
 homepage: "https://github.com/c-cube/qcheck/";
 license: "BSD-2-Clause"
 doc: ["http://c-cube.github.io/qcheck/";]
-version: "0.18"
+version: "0.18.1"
 tags: [
   "test"
   "property"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/src/core/QCheck.ml 
new/ocaml-qcheck-0.18.1/src/core/QCheck.ml
--- old/ocaml-qcheck-0.18/src/core/QCheck.ml    2021-09-10 17:43:20.000000000 
+0200
+++ new/ocaml-qcheck-0.18.1/src/core/QCheck.ml  2022-02-03 16:20:08.000000000 
+0100
@@ -248,27 +248,27 @@
     List.sort (fun (w1, _) (w2, _) -> poly_compare w1 w2) samples |> 
List.rev_map snd
 
   let range_subset ~size low high st =
-    if not (low <= high && size <= high - low + 1) then invalid_arg 
"Gen.range_subset";
+    let range_size = high - low + 1 in
+    if not (0 <= size && size <= range_size) then
+      invalid_arg "Gen.range_subset";
     (* The algorithm below is attributed to Floyd, see for example
        https://eyalsch.wordpress.com/2010/04/01/random-sample/
        https://math.stackexchange.com/questions/178690
 
-       Note: the code be made faster by checking membership in [arr]
-       directly instead of using an additional Set. None of our
-       dependencies implements dichotomic search, so using Set is
-       easier.
+       Note: the code is easier to read when drawing from [0..range_size-1]
+       rather than [low..high]. We draw in [0..bound], and shift the
+       results by adding [low] when writing them to the result array.
     *)
     let module ISet = Set.Make(Int) in
     let s = ref ISet.empty in
-    let arr = Array.make size 0 in
-    for i = high - size to high do
-      let pos = int_range high i st in
-      let choice =
-        if ISet.mem pos !s then i else pos
-      in
-      arr.(i - low) <- choice;
+    for i = range_size - size to range_size - 1 do
+      let pos = int_range 0 i st in
+      let choice = if ISet.mem pos !s then i else pos in
       s := ISet.add choice !s;
     done;
+    let arr = Array.make size 0 in
+    let idx = ref 0 in
+    ISet.iter (fun choice -> arr.(!idx) <- low + choice; incr idx) !s;
     arr
 
   let array_subset size arr st =
@@ -334,31 +334,38 @@
 
   (* nat splitting *)
 
-  let nat_split2 n st =
-    if (n < 2) then invalid_arg "nat_split2";
+  let pos_split2 n st =
+    if (n < 2) then invalid_arg "pos_split2";
     let n1 = int_range 1 (n - 1) st in
     (n1, n - n1)
 
-  let pos_split2 n st =
+  let nat_split2 n st =
+    if (n < 0) then invalid_arg "nat_split2";
     let n1 = int_range 0 n st in
     (n1, n - n1)
 
   let pos_split ~size:k n st =
-    if (k > n) then invalid_arg "nat_split";
-    (* To split n into n{0}+n{1}+..+n{k-1}, we draw distinct "boundaries"
-       b{-1}..b{k-1}, with b{-1}=0 and b{k-1} = n
-       and the k-1 intermediate boundaries b{0}..b{k-2}
-       chosen randomly distinct in [1;n-1].
-
-       Then each n{i} is defined as b{i}-b{i-1}. *)
-    let b = range_subset ~size:(k-1) 1 (n - 1) st in
-    Array.init k (fun i ->
-      if i = 0 then b.(0)
-      else if i = k-1 then n - b.(i-1)
-      else b.(i) - b.(i-1)
-    )
+    if (n < 0) then invalid_arg "pos_split";
+    if 0 = k && 0 = n then [||]
+    else begin
+      if not (0 < k && k <= n) then invalid_arg "pos_split";
+      (* To split n into n{0}+n{1}+..+n{k-1}, we draw distinct "boundaries"
+         b{-1}..b{k-1}, with b{-1}=0 and b{k-1} = n
+         and the k-1 intermediate boundaries b{0}..b{k-2}
+         chosen randomly distinct in [1;n-1].
+
+         Then each n{i} is defined as b{i}-b{i-1}. *)
+      let b = range_subset ~size:(k-1) 1 (n - 1) st in
+      if k = 1 then [|n|]
+      else Array.init k (fun i ->
+        if i = 0 then b.(0)
+        else if i = k-1 then n - b.(i-1)
+        else b.(i) - b.(i-1)
+      )
+    end
 
   let nat_split ~size:k n st =
+    if not (0 <= k && 0 <= n) then invalid_arg "nat_split";
     pos_split ~size:k (n+k) st
     |> Array.map (fun v -> v - 1)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/src/core/QCheck.mli 
new/ocaml-qcheck-0.18.1/src/core/QCheck.mli
--- old/ocaml-qcheck-0.18/src/core/QCheck.mli   2021-09-10 17:43:20.000000000 
+0200
+++ new/ocaml-qcheck-0.18.1/src/core/QCheck.mli 2022-02-03 16:20:08.000000000 
+0100
@@ -467,22 +467,22 @@
 
       This is useful to split sizes to combine sized generators.
 
-      @raise Invalid_argument unless [n >= 2].
-
       @since 0.18
   *)
 
   val pos_split2 : int -> (int * int) t
-  (** [nat_split2 n] generates pairs [(n1, n2)] of strictly positive
+  (** [pos_split2 n] generates pairs [(n1, n2)] of strictly positive
       (nonzero) natural numbers with [n1 + n2 = n].
 
+      @raise Invalid_argument unless [n >= 2].
+
       This is useful to split sizes to combine sized generators.
 
       @since 0.18
   *)
 
   val nat_split : size:int -> int -> int array t
-  (** [nat_split2 ~size:k n] generates [k]-sized arrays [n1,n2,..nk]
+  (** [nat_split ~size:k n] generates [k]-sized arrays [n1,n2,..nk]
       of natural numbers in [[0;n]] with [n1 + n2 + ... + nk = n].
 
       This is useful to split sizes to combine sized generators.
@@ -493,7 +493,7 @@
   *)
 
   val pos_split : size:int -> int -> int array t
-  (** [nat_split2 ~size:k n] generates [k]-sized arrays [n1,n2,..nk]
+  (** [pos_split ~size:k n] generates [k]-sized arrays [n1,n2,..nk]
       of strictly positive (non-zero) natural numbers with
       [n1 + n2 + ... + nk = n].
 
@@ -501,7 +501,7 @@
 
       Complexity O(k log k).
 
-      @raise Invalid_argument unless [k <= n].
+      @raise Invalid_argument unless [0 < k <= n] or [0 = k = n].
 
       @since 0.18
   *)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-qcheck-0.18/test/core/QCheck_expect_test.ml 
new/ocaml-qcheck-0.18.1/test/core/QCheck_expect_test.ml
--- old/ocaml-qcheck-0.18/test/core/QCheck_expect_test.ml       2021-09-10 
17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/test/core/QCheck_expect_test.ml     2022-02-03 
16:20:08.000000000 +0100
@@ -83,7 +83,16 @@
          true)
 end
 
-(* positive tests of the various generators *)
+(* positive tests of the various generators
+
+   Note: it is important to disable shrinking for these tests, as the
+   shrinkers will suggest inputs that are coming from the generator
+   themselves -- which we want to test -- so their reduced
+   counter-example are confusing rather than helpful.
+
+   This is achieved by using (Test.make ~print ...), without a ~shrink
+   argument.
+*)
 module Generator = struct
   open QCheck
 
@@ -127,6 +136,82 @@
       ~name:"tree_rev_is_involutive"
       QCheck.(make IntTree.gen_tree)
       (fun tree -> IntTree.(rev_tree (rev_tree tree)) = tree)
+
+  let nat_split2_spec =
+    Test.make ~name:"nat_split2 spec"
+      (make
+        ~print:Print.(pair int (pair int int))
+         Gen.(small_nat >>= fun n ->
+              pair (return n) (nat_split2 n)))
+      (fun (n, (a, b)) ->
+         0 <= a && 0 <= b && a + b = n)
+
+  let pos_split2_spec =
+    Test.make ~name:"pos_split2 spec"
+      (make
+        ~print:Print.(pair int (pair int int))
+         Gen.(small_nat >>= fun n ->
+              (* we need n > 2 *)
+              let n = n + 2 in
+              pair (return n) (pos_split2 n)))
+      (fun (n, (a, b)) ->
+         (0 < a && 0 < b && a + b = n))
+
+  let range_subset_spec =
+    Test.make ~name:"range_subset_spec"
+      (make
+         ~print:Print.(quad int int int (array int))
+         Gen.(pair small_nat small_nat >>= fun (m, n) ->
+              (* we must guarantee [low <= high]
+                 and [size <= high - low + 1] *)
+              let low = m and high = m + n in
+              int_range 0 (high - low + 1) >>= fun size ->
+              quad (return size) (return low) (return high)
+                (range_subset ~size low high)))
+      (fun (size, low, high, arr) ->
+         if size = 0 then arr = [||]
+         else
+           Array.length arr = size
+           && low <= arr.(0)
+           && Array.for_all (fun (a, b) -> a < b)
+               (Array.init (size - 1) (fun k -> arr.(k), arr.(k+1)))
+           && arr.(size - 1) <= high)
+
+  let nat_split_n_way =
+    Test.make ~name:"nat_split n-way"
+      (make
+         ~print:Print.(pair int (array int))
+         Gen.(small_nat >>= fun n ->
+              pair (return n) (nat_split ~size:n n)))
+      (fun (n, arr) ->
+         Array.length arr = n
+         && Array.for_all (fun k -> 0 <= k) arr
+         && Array.fold_left (+) 0 arr = n)
+
+  let nat_split_smaller =
+    Test.make ~name:"nat_split smaller"
+      (make
+         ~print:Print.(triple int int (array int))
+         Gen.(small_nat >>= fun size ->
+              int_bound size >>= fun n ->
+              triple (return size) (return n) (nat_split ~size n)))
+      (fun (m, n, arr) ->
+         Array.length arr = m
+         && Array.for_all (fun k -> 0 <= k) arr
+         && Array.fold_left (+) 0 arr = n)
+
+  let pos_split =
+    Test.make ~name:"pos_split"
+      (make
+         ~print:Print.(triple int int (array int))
+         Gen.(pair small_nat small_nat >>= fun (m, n) ->
+              (* we need both size>0 and n>0 and size <= n *)
+              let size = 1 + min m n and n = 1 + max m n in
+              triple (return size) (return n) (pos_split ~size n)))
+      (fun (m, n, arr) ->
+         Array.length arr = m
+         && Array.for_all (fun k -> 0 < k) arr
+         && Array.fold_left (+) 0 arr = n)
 end
 
 (* negative tests that exercise shrinking behaviour *)
@@ -385,6 +470,11 @@
   let tree_depth_test =
     let depth = ("depth", IntTree.depth) in
     Test.make ~name:"tree's depth" ~count:1000 (add_stat depth (make 
IntTree.gen_tree)) (fun _ -> true)
+
+  let range_subset_test =
+    Test.make ~name:"range_subset_spec" ~count:5_000
+      (add_stat ("dist", fun a -> a.(0)) (make (Gen.range_subset ~size:1 0 
20)))
+      (fun a -> Array.length a = 1)
 end
 
 (* Calling runners *)
@@ -407,6 +497,12 @@
     Generator.list_repeat_test;
     Generator.array_repeat_test;
     Generator.passing_tree_rev;
+    Generator.nat_split2_spec;
+    Generator.pos_split2_spec;
+    Generator.range_subset_spec;
+    Generator.nat_split_n_way;
+    Generator.nat_split_smaller;
+    Generator.pos_split;
     (*Shrink.test_fac_issue59;*)
     Shrink.big_bound_issue59;
     Shrink.long_shrink;
@@ -435,7 +531,8 @@
     FindExample.find_ex_uncaught_issue_99_2_succeed;
     Stats.bool_dist;
     Stats.char_dist;
-    Stats.tree_depth_test]
+    Stats.tree_depth_test;
+    Stats.range_subset_test]
     @ Stats.string_len_tests
     @ Stats.list_len_tests
     @ Stats.array_len_tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ocaml-qcheck-0.18/test/core/qcheck_output.txt.expected 
new/ocaml-qcheck-0.18.1/test/core/qcheck_output.txt.expected
--- old/ocaml-qcheck-0.18/test/core/qcheck_output.txt.expected  2021-09-10 
17:43:20.000000000 +0200
+++ new/ocaml-qcheck-0.18.1/test/core/qcheck_output.txt.expected        
2022-02-03 16:20:08.000000000 +0100
@@ -378,6 +378,32 @@
   14: #                                                                 7
   15:                                                                   4
 
++++ Stats for range_subset_spec 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+stats dist:
+  num: 5000, avg: 9.97, stddev: 6.08, median 10, min 0, max 20
+   0: #################################################               246
+   1: ################################################                244
+   2: ################################################                240
+   3: ################################################                243
+   4: ##############################################                  232
+   5: ##############################################                  230
+   6: ###############################################                 239
+   7: ###############################################                 235
+   8: #######################################################         274
+   9: ##############################################                  233
+  10: ##########################################                      212
+  11: ##############################################                  231
+  12: ###############################################                 239
+  13: #############################################                   226
+  14: #############################################                   225
+  15: ###################################################             256
+  16: ################################################                240
+  17: #############################################                   229
+  18: ################################################                243
+  19: ##################################################              253
+  20: ##############################################                  230
+
 +++ Stats for string_size len dist 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 stats len:
@@ -863,7 +889,7 @@
    4150517416584649600.. 4611686018427387903: #################                
                               189
 
================================================================================
 1 warning(s)
-failure (26 tests failed, 1 tests errored, ran 66 tests)
+failure (26 tests failed, 1 tests errored, ran 73 tests)
 random seed: 153870556
 
 +++ Stats for int_dist_empty_bucket 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Reply via email to