-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Strange behaviour of string(:printable) with min_length opt given #99
Comments
I'll investigate but my guess is
Please open another issue for discussing this. |
I thought so too at first, but here is what I got:
So, for 40-symbol codepoints string it is around 160 bytes.
|
String.length considers graphemes and not codepoints, so maybe that’s it?
--
*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*
|
The thing is that we are generating a list of |
Yes, as the @josevalim pointed it's because of the difference between counting codepoints and counting graphems.
For me, personally, this problem arose when I tested my Ecto schemas (similar to the example in #100). In validator I had Maybe we could add |
Hi! I'm using
stream_data
to test myEcto
schemas, but I ran into a small problem concerningmin_length
opt given toStreamData.string(:printable)
.Error:
PS> Off topic. Don't want to spam with feature requests, but is it possible to add
invert
function that reverts generators? Soinvert(string(:alphanumeric, min_length: 10))
gives us aone_of([string(:alphanumeric, max_length: 9), string(:printable) |> filter(&(not String.match?(&1, ~r/^[0-9A-Za-z]+$/)))])
? At the first glance It is always set-theoretically possible and may be very handy.The text was updated successfully, but these errors were encountered: