-
Notifications
You must be signed in to change notification settings - Fork 31
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
enhancement: negative examples? #29
Comments
I like the idea, but I suppose this problem should be solved be a separate gem - what do you think? For example, we could have Or even, if the problem is feasibly doable, this could be a core ruby method - e.g.
|
...But what does a negated Edit -- See also: https://bugs.ruby-lang.org/issues/5588 |
Is there a way to generate counter-examples to a regex pattern? This would be incredibly useful for writing tests for format validators. Think
validates_format_of
for shoulda-matchers.Conceptually, it would enumerate all strings that don't match the pattern.
Ideal behavior:
it seems like this is computationally possible at least. the complement of a regular language is also regular, which means that you can enumerate the counter-examples by "negating" the regular expression's deterministic finite automaton representation, and then enumerating examples from that.
https://math.stackexchange.com/questions/685182/complement-of-a-regular-expression
The text was updated successfully, but these errors were encountered: