Replies: 1 comment 1 reply
-
If I understand correctly, I think this case could be solved pretty simply by generating an array of natural numbers (as you suggest), but consider them indices into the binary data, and use those indices as chunk slices. Of course also use the modulo of each natural number, as in |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm new to fast-check and I'm testing some code that assembles a stream of binary chunks of UTF8-encoded strings into JavaScript strings. The way I test this (for the case of valid data) is by choosing an arbitrary unicode string and a number indicating a split point, and then converting the string to binary and splitting it at that point:
That only handles the case of two chunks, and I'd like to expand testing to an arbitrary number of chunks. It seems like I need more random numbers for that. I could generate an array of natural numbers for chunk sizes and filter it out if they sum to longer than the binary data, but that seems wasteful?
I'm wondering if the case where you want to split arbitrary arrays into arbitrary chunks is common enough that fast-check should have a built-in way to do it. Or maybe there's a better way to go about this?
Beta Was this translation helpful? Give feedback.
All reactions