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

Better balance between values produced by fc.anything() #324

Closed
dubzzz opened this issue Feb 28, 2019 · 1 comment
Closed

Better balance between values produced by fc.anything() #324

dubzzz opened this issue Feb 28, 2019 · 1 comment

Comments

@dubzzz
Copy link
Owner

dubzzz commented Feb 28, 2019

Today fc.anything() produces:

[object Array]......53.42%
[object Number].....19.95%
[object String]......8.91%
[object Object]......6.65%
[object Boolean].....6.65%
[object Null]........2.24%
[object Undefined]...2.17%

Statistics gathered for the default fc.anything() on v1.11.0 for 100k samples

The proportion of objects is too small and should be increased.

Target would be to have:

  • 1/3 arrays
  • 1/3 objects
  • 1/3 basic values

Or with Set and Map enabled:

  • 1/5 arrays
  • 1/5 objects
  • 1/5 sets
  • 1/5 maps
  • 1/5 basic values
@dubzzz
Copy link
Owner Author

dubzzz commented Feb 28, 2019

Statistics have been gathered with the following snippet:

fc.statistics(
    fc.anything(),
    v => Object.prototype.toString.call(v),
    100000);

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

No branches or pull requests

1 participant