Skip to content

Commit c2f6e18

Browse files
authored
Merge pull request #297 from shym/vocabulary
Rename the bounds of the tree generators
2 parents d20a902 + f7dc5ce commit c2f6e18

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/domain/domain_spawntree.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ type cmd =
2727
(*| Join*)
2828
| Spawn of cmd list [@@deriving show { with_path = false }]
2929

30-
let gen max_depth max_width =
31-
let depth_gen = Gen.int_bound max_depth in
32-
let width_gen = Gen.int_bound max_width in
33-
Gen.sized_size depth_gen @@ Gen.fix (fun rgen n ->
30+
let gen max_height max_degree =
31+
let height_gen = Gen.int_bound max_height in
32+
let degree_gen = Gen.int_bound max_degree in
33+
Gen.sized_size height_gen @@ Gen.fix (fun rgen n ->
3434
match n with
3535
| 0 -> Gen.oneofl [Incr;Decr]
3636
| _ ->
3737
Gen.oneof
3838
[
3939
Gen.oneofl [Incr;Decr];
40-
Gen.map (fun ls -> Spawn ls) (Gen.list_size width_gen (rgen (n/2)))
40+
Gen.map (fun ls -> Spawn ls) (Gen.list_size degree_gen (rgen (n-1)))
4141
])
4242

4343
let rec shrink_cmd = function
@@ -63,12 +63,12 @@ let rec dom_interp a = function
6363
let ds = List.map (fun c -> Domain.spawn (fun () -> dom_interp a c)) cs in
6464
List.iter Domain.join ds
6565

66-
let t ~max_depth ~max_width = Test.make
66+
let t ~max_height ~max_degree = Test.make
6767
~name:"domain_spawntree - with Atomic"
6868
~count:100
6969
~retries:10
70-
(*~print:show_cmd (gen max_depth max_width)*)
71-
(make ~print:show_cmd ~shrink:shrink_cmd (gen max_depth max_width))
70+
(*~print:show_cmd (gen max_height max_degree)*)
71+
(make ~print:show_cmd ~shrink:shrink_cmd (gen max_height max_degree))
7272

7373
((*Util.fork_prop_with_timeout 30*) (* forking a fresh process starts afresh, it seems *)
7474
(fun c ->
@@ -85,4 +85,4 @@ let t ~max_depth ~max_width = Test.make
8585
else (Printf.printf "Failure \"%s\"\n%!" s; false)
8686
))
8787
;;
88-
QCheck_base_runner.run_tests_main [t ~max_depth:20 ~max_width:10]
88+
QCheck_base_runner.run_tests_main [t ~max_height:5 ~max_degree:10]

src/thread/thread_createtree.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ type cmd =
2727
(*| Join*)
2828
| Create of cmd list [@@deriving show { with_path = false }]
2929

30-
let gen max_depth max_width =
31-
let depth_gen = Gen.int_bound max_depth in
32-
let width_gen = Gen.int_bound max_width in
33-
Gen.sized_size depth_gen @@ Gen.fix (fun rgen n ->
30+
let gen max_height max_degree =
31+
let height_gen = Gen.int_bound max_height in
32+
let degree_gen = Gen.int_bound max_degree in
33+
Gen.sized_size height_gen @@ Gen.fix (fun rgen n ->
3434
match n with
3535
| 0 -> Gen.oneofl [Incr;Decr]
3636
| _ ->
3737
Gen.oneof
3838
[
3939
Gen.oneofl [Incr;Decr];
40-
Gen.map (fun ls -> Create ls) (Gen.list_size width_gen (rgen (n/2)))
40+
Gen.map (fun ls -> Create ls) (Gen.list_size degree_gen (rgen (n-1)))
4141
])
4242

4343
let rec shrink_cmd = function
@@ -63,15 +63,15 @@ let rec thread_interp a = function
6363
let ts = List.map (fun c -> Thread.create (fun () -> thread_interp a c) ()) cs in
6464
List.iter Thread.join ts
6565

66-
let t ~max_depth ~max_width = Test.make
66+
let t ~max_height ~max_degree = Test.make
6767
~name:"thread_createtree - with Atomic"
6868
~count:1000
6969
~retries:100
70-
(make ~print:show_cmd ~shrink:shrink_cmd (gen max_depth max_width))
70+
(make ~print:show_cmd ~shrink:shrink_cmd (gen max_height max_degree))
7171
(fun c ->
7272
(*Printf.printf "%s\n%!" (show_cmd c);*)
7373
let a = Atomic.make 0 in
7474
let () = thread_interp a c in
7575
Atomic.get a = interp 0 c)
7676
;;
77-
QCheck_base_runner.run_tests_main [t ~max_depth:20 ~max_width:10]
77+
QCheck_base_runner.run_tests_main [t ~max_height:5 ~max_degree:10]

0 commit comments

Comments
 (0)