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

♻️ Implement sliced based generator for arrays #3047

Merged
merged 2 commits into from
Jul 4, 2022
Merged

Conversation

dubzzz
Copy link
Owner

@dubzzz dubzzz commented Jul 4, 2022

Sliced based generators will make it possible to implement features like the long awaited one: "Helper to deal with dangerous strings" #484. Indeed they will make arrays able to generate pre-defined values so that some barely impossible to generate values like ['_','_','p','r','o','t','o','_','_'] will be more likely for strings.

The current PR mostly adds the internals to make it possible within arrays. But there is for the moment nothing to connect it, neither externally for fast-check's users nor internally for our strings. Here we mostly pave the way for it without really making it real.

So from an external point of view, this PR mostly deals with refactoring internals. From our point of view, it adds an important feature, not yet visible but things introduced by the PR will be game changer.

Category:

  • ✨ Introduce new features
  • 📝 Add or update documentation
  • ✅ Add or update tests
  • 🐛 Fix a bug
  • 🏷️ Add or update types
  • ⚡️ Improve performance
  • Other(s): ...

Potential impacts:

  • Generated values
  • Shrink values
  • Performance
  • Typings
  • Other(s): ...

Sliced based generators will make it possible to implement features like the long awaited one: "Helper to deal with dangerous strings" #484. Indeed they will make arrays able to generate pre-defined values so that some barely impossible to generate values like `['_','_','p','r','o','t','o','_','_']` will be more likely for strings.

The current PR mostly adds the internals to make it possible within arrays. But there is for the moment nothing to connect it, neither externally for fast-check's users nor internally for our strings. Here we mostly pave the way for it without really making it real. So from an external point of view, this PR mostly deals with refactoring internals.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 4, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit deaf6e0:

Sandbox Source
Vanilla Configuration
@fast-check/examples Configuration

@dubzzz dubzzz changed the title ♻️ Implement sliced based generator for arrays ✨ Implement sliced based generator for arrays Jul 4, 2022
@dubzzz dubzzz changed the title ✨ Implement sliced based generator for arrays ♻️ Implement sliced based generator for arrays Jul 4, 2022
@codecov
Copy link

codecov bot commented Jul 4, 2022

Codecov Report

Merging #3047 (deaf6e0) into main (d7ba0ca) will increase coverage by 0.01%.
The diff coverage is 95.58%.

@@            Coverage Diff             @@
##             main    #3047      +/-   ##
==========================================
+ Coverage   95.86%   95.88%   +0.01%     
==========================================
  Files         205      209       +4     
  Lines        5227     5293      +66     
  Branches     1017     1024       +7     
==========================================
+ Hits         5011     5075      +64     
- Misses        216      218       +2     
Flag Coverage Δ
unit-tests 95.88% <95.58%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...arbitrary/_internals/interfaces/SlicedGenerator.ts 0.00% <0.00%> (ø)
...bitrary/_internals/helpers/BuildSlicedGenerator.ts 88.88% <88.88%> (ø)
..._internals/implementations/SlicedBasedGenerator.ts 97.56% <97.56%> (ø)
...t-check/src/arbitrary/_internals/ArrayArbitrary.ts 100.00% <100.00%> (ø)
.../_internals/implementations/NoopSlicedGenerator.ts 100.00% <100.00%> (ø)
packages/fast-check/src/arbitrary/double.ts 100.00% <0.00%> (+2.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7ba0ca...deaf6e0. Read the comment docs.

@dubzzz dubzzz merged commit 8607cb7 into main Jul 4, 2022
@dubzzz dubzzz deleted the new-sliced-gen-array branch July 4, 2022 19:58
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.

1 participant