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

Int shrinkers #92

Merged
merged 2 commits into from
May 19, 2020
Merged

Int shrinkers #92

merged 2 commits into from
May 19, 2020

Conversation

jmid
Copy link
Collaborator

@jmid jmid commented May 17, 2020

This is addressing #82.
It just copies the int shrinking strategy. Potentially we could factor out the general strategy and parameterize all three integer shrinkers over this common core. For now I chose to keep them very similar and right next to each other.

It seems to work fine:

# let t = Test.make int32 (fun i -> i < 2343544l);;
val t : Test.t = QCheck.Test.Test <abstr>
# QCheck_runner.run_tests ~verbose:true [t];;
generated error fail pass / total     time test name
[✗]    1    0    1    0 /  100     0.0s anon_test_3

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

Test anon_test_3 failed (14 shrink steps):

2343544l
================================================================================
failure (1 tests failed, 0 tests errored, ran 1 tests)
- : int = 1
# QCheck_runner.run_tests ~verbose:true [t];;
generated error fail pass / total     time test name
[✗]    1    0    1    0 /  100     0.0s anon_test_3

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

Test anon_test_3 failed (16 shrink steps):

2343544l
================================================================================
failure (1 tests failed, 0 tests errored, ran 1 tests)
- : int = 1
# let t = Test.make int64 (fun i -> i < 2343544L);;
val t : Test.t = QCheck.Test.Test <abstr>
# QCheck_runner.run_tests ~verbose:true [t];;
generated error fail pass / total     time test name
[✗]    5    0    1    4 /  100     0.0s anon_test_4

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

Test anon_test_4 failed (51 shrink steps):

2343544L
================================================================================
failure (1 tests failed, 0 tests errored, ran 1 tests)
- : int = 1
# QCheck_runner.run_tests ~verbose:true [t];;
generated error fail pass / total     time test name
[✗]    1    0    1    0 /  100     0.0s anon_test_4

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

Test anon_test_4 failed (49 shrink steps):

2343544L
================================================================================
failure (1 tests failed, 0 tests errored, ran 1 tests)
- : int = 1

@c-cube c-cube merged commit c962918 into c-cube:master May 19, 2020
@jmid jmid deleted the int-shrinkers branch September 8, 2021 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants