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

Add ascii/latin1/unicode character generators #96

Merged
merged 2 commits into from
May 16, 2017
Merged

Add ascii/latin1/unicode character generators #96

merged 2 commits into from
May 16, 2017

Conversation

moodmosaic
Copy link
Member

@@ -354,7 +368,7 @@ module Gen =

/// Generates a random string.
let string : Gen<string> =
choice [alphaNum; charBounded] |> string'
choice [alphaNum; unicodeAll] |> string'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be just unicode given the surrogates won't be a legal string unless they're combined correctly? (sorry I don't know that much about unicode surrogates, but I get the impression this wouldn't be a valid string as such)

Copy link
Member Author

@moodmosaic moodmosaic May 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... True, unicode is a better default, I'll change it.

And, I think, we need something similar in the Haskell version? Right now it uses min/max bounds of char, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a haskell version, the haskell Gen.string takes a Gen<char> as an argument

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done now in 4979fb5.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I wonder if we should just rename string' -> string and delete this, let people make their own choices for characters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was exactly what I was thinking right now... We're going to have Gen.fs in line with the Haskell one anyway, so good idea. I'll undo 4979fb5 also.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I just pushed f39c328.

… the specified character generator.

This brings the Gen module closer to the Haskell version.

See also: #96 (comment)
@jacobstanley
Copy link
Member

👍 sorry for the delay

@jacobstanley jacobstanley merged commit 0cbd7fe into hedgehogqa:master May 16, 2017
@moodmosaic moodmosaic deleted the topic/unicode branch May 16, 2017 05:34
@ghost ghost modified the milestones: 0.2.0, 0.2.1 Sep 22, 2021
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