Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realign shrinker tests #274

Merged
merged 3 commits into from
May 1, 2023
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
2 changes: 1 addition & 1 deletion test/core/QCheck2_expect_test.expected.64
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Test char never produces 'abcdef' failed (1 shrink steps):

--- Failure --------------------------------------------------------------------

Test printable never produces '!"#$%&'' failed (1 shrink steps):
Test printable never produces '!"#$%&' failed (1 shrink steps):

'!'

Expand Down
2 changes: 1 addition & 1 deletion test/core/QCheck2_expect_test.expected.ocaml5
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Test char never produces 'abcdef' failed (1 shrink steps):

--- Failure --------------------------------------------------------------------

Test printable never produces '!"#$%&'' failed (1 shrink steps):
Test printable never produces '!"#$%&' failed (1 shrink steps):

'!'

Expand Down
4 changes: 2 additions & 2 deletions test/core/QCheck2_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ module Shrink = struct
Gen.char (fun c -> not (List.mem c ['a';'b';'c';'d';'e';'f']))

let printable_is_never_sign = (* should shrink towards '!' with lowest ascii code 33 *)
Test.make ~name:"printable never produces '!\"#$%&''" ~count:1000 ~print:Print.char
Gen.printable (fun c -> not (List.mem c ['!';'@';'#';'$';'%']))
Test.make ~name:"printable never produces '!\"#$%&'" ~count:1000 ~print:Print.char
Gen.printable (fun c -> not (List.mem c ['!';'"';'#';'$';'%';'&']))

let numeral_is_never_less_5 =
Test.make ~name:"printable never produces less than '5" ~count:1000 ~print:Print.char
Expand Down
8 changes: 7 additions & 1 deletion test/core/QCheck_expect_test.expected.64
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@ Leaf 0

--- Failure --------------------------------------------------------------------

Test sum list = 0 failed (0 shrink steps):

[7; 1; 42; 1; 8; 5; 3; 9; 5; 38; 3; 3; 0; 1; 98; 1; 4; 13; 9; 2; 6; 9; 47; 6; 5; 8; 8; 6; 0; 9; 7; 2; 8; 6; 62; 6; 4; 31; 19; 1; 41; 60; 6; 5; 8; 1; 1; 4; 7; 7; 0; 5; 5; 71; 14; 26; 47; 5; 1; 6; 34; 9; 4; 2; 37; 3; 8; 4; 31; 6; 2; 1; 0; 7; 5; 1; 0; 15; 6; 1; 8; 13; 0; 6; 2; 4; 2; 6; 6; 1; 4; 1; 9; 79; 0; 87; 6; 8; 8; 62; 1; 4; 62; 6; 31; 1; 5; 6; 5; 9; 3; 3; 1; 79; 4; 3; 2; 67; 5; 7; 12; 70; 8; 8; 6; 1; 3; 14; 15; 1; 61; 4; 1; 4; 1; 7; 4; 4; 4; 2; 8; 8; 7; 5; 4; 27; 0; 9; 80; 25; 1; 8; 1; 3; 7; 4; 3; 5; 5; 6; 5; 5; 31; 7; 0; 3; 3; 6; 71; 76; 28; 60; 6; 2; 6; 3; 0; 4; 1; 0; 5; 7; 0; 28; 86; 4; 7; 51; 36; 0; 5; 0; 1; 4; 3; 6; 0; 1; 1; 8; 18; 4; 2; 8; 8; 1; 4; 7; 1; 0; 93; 5; 3; 0; 80; 1; 7; 7; 8; 8; 5; 7; 8; 9; 24; 4; 25; 8; 8; 5; 4; 90; 4; 6; 8; 4; 4; 0; 60; 8; 9; 7; 44; 5; 1; 2; 9; 74; 7; 7]

--- Failure --------------------------------------------------------------------

Test fail_pred_map_commute failed (77 shrink steps):

([1], {_ -> 0}, {1 -> true; _ -> false})
Expand Down Expand Up @@ -1394,7 +1400,7 @@ stats dist:
4150517416584649600.. 4611686018427387903: ################# 189
================================================================================
1 warning(s)
failure (63 tests failed, 3 tests errored, ran 148 tests)
failure (64 tests failed, 3 tests errored, ran 149 tests)
random seed: 153870556

+++ Stats for int_dist_empty_bucket ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
8 changes: 7 additions & 1 deletion test/core/QCheck_expect_test.expected.ocaml5
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,12 @@ Leaf 0

--- Failure --------------------------------------------------------------------

Test sum list = 0 failed (0 shrink steps):

[46; 2; 22; 4; 4; 2; 6; 5; 88; 24; 7; 9; 9; 2; 5; 1; 55; 8; 45; 1; 96; 0; 1; 2; 7; 4; 1; 5; 95; 6; 8; 6; 4; 0; 5; 5; 22; 87; 2; 1; 1; 0; 2; 2; 9; 5; 9; 3; 7; 59; 7; 96; 6; 5; 1; 3; 9; 9; 65; 6; 7; 7; 2; 5; 0; 0; 70; 5; 5; 2; 1; 57; 9; 7; 8; 10; 9; 7; 9; 75; 73; 80; 7; 9; 4; 3; 16; 5; 79; 1; 8; 6; 2; 3; 4; 9; 2; 8; 4; 6; 50; 2; 1; 5; 9; 5; 4; 3; 56; 6; 5; 9; 4; 1; 47; 1; 2; 5; 2; 0; 7; 31; 55; 6; 7; 4; 7; 8; 8; 2; 4; 40; 4; 6; 9; 3; 59; 5; 1; 0; 2; 6; 90; 1; 6; 81; 0; 1; 3; 7; 2; 4; 5; 4; 7; 3; 62; 0; 1; 6; 7; 5; 97; 83; 41; 7; 2; 6; 3; 0; 4; 8; 99; 8; 6; 0; 7; 9; 7; 1; 55; 30; 25; 3; 4; 7; 1; 6; 80; 8; 0; 4; 21; 3; 5; 9; 27; 10; 60; 47; 54; 6; 5; 8; 1; 5; 9; 65; 9; 5; 7; 7; 6; 48; 9; 5; 6; 4; 9; 7; 1; 2; 71; 6; 9; 2; 7; 8; 14; 59; 71; 30; 7; 3; 5; 4; 6; 7; 3; 6; 9; 8; 2; 38; 6; 6; 7; 1; 5; 2; 43; 5; 2; 9; 3; 0; 3; 2; 7; 71; 26; 3; 9; 11; 5; 1; 5; 2; 53; 46; 4; 6; 7; 67; 1; 0; 34; 0; 48; 5; 5; 0; 7; 49; 92; 8; 3; 0; 67; 1; 5; 2; 9; 5; 9; 3; 1; 4; 8; 0; 3; 6; 46; 58; 1; 54; 77; 0; 96; 1; 6; 2; 8; 22; 3; 9; 2; 6; 25; 49; 9; 6; 3; 8; 5; 9; 54; 1; 7; 5; 6; 5; 1; 7; 8; 23; 4; 6; 4; 2; 5; 8; 4; 7; 4]

--- Failure --------------------------------------------------------------------

Test fail_pred_map_commute failed (79 shrink steps):

([11], {_ -> 0}, {11 -> false; _ -> true})
Expand Down Expand Up @@ -1404,7 +1410,7 @@ stats dist:
4150517416584649600.. 4611686018427387903: ################# 195
================================================================================
1 warning(s)
failure (63 tests failed, 3 tests errored, ran 148 tests)
failure (64 tests failed, 3 tests errored, ran 149 tests)
random seed: 153870556

+++ Stats for int_dist_empty_bucket ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
6 changes: 6 additions & 0 deletions test/core/QCheck_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,11 @@ module Shrink = struct
IntTree.(make ~print:print_tree ~shrink:shrink_tree gen_tree)
(fun tree -> IntTree.contains_only_n tree 42)

let test_gen_no_shrink =
Test.make ~name:"sum list = 0"
(set_shrink Shrink.nil (list small_int))
(fun xs -> List.fold_left (+) 0 xs = 0)

let tests = [
(*test_fac_issue59;*)
big_bound_issue59;
Expand Down Expand Up @@ -748,6 +753,7 @@ module Shrink = struct
(*list_equal_dupl;*)
list_unique_elems;
tree_contains_only_42;
test_gen_no_shrink;
]
end

Expand Down