<< Back to previous view

[TCHECK-60] string from regular expression generator Created: 23/Jan/15  Updated: 23/Jan/15

Status: Open
Project: test.check
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Steve Miner Assignee: Reid Draper
Resolution: Unresolved Votes: 0
Labels: None


 Description   

A regular expression is a succinct and flexible way to describe a set of strings. It would be useful to have generator that takes a regular expression and generates matching strings.

There was some hallway discussion about this feature request at the Clojure Conj in November 2014.



 Comments   
Comment by Steve Miner [ 23/Jan/15 9:12 AM ]

https://github.com/gfredericks/test.chuck recently added string-from-regex. That's a good work-around for most users.

Comment by Steve Miner [ 23/Jan/15 9:16 AM ]

https://github.com/miner/herbert recently added a new implementation of a string from regex generator (in v0.6.7). Herbert supports a more limited regex syntax than the generator from test.chuck, but it has no dependencies on other libraries so it can more easily be adopted in a contrib library.





[TCHECK-59] s-pos-int and s-pos-int generators have an off-by-1 issue Created: 22/Jan/15  Updated: 22/Jan/15

Status: Open
Project: test.check
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Jay A. Patel Assignee: Reid Draper
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Clojure 1.6.0
test.check 0.6.2



 Description   

=== Problem ===

gen/s-pos-int and gen/s-neg-int do not strictly respect size parameter. Generated values can be off-by-1 from the size value.

=== Samples ===

test=> (gen/sample (gen/resize 5 gen/s-pos-int))
(6 1 3 2 2 1 3 6 6 3)

test=> (gen/sample (gen/resize 5 gen/s-neg-int))
(-1 -6 -2 -6 -5 -3 -2 -1 -4 -3)

=== Root Cause ===

(def s-pos-int
"Generate strictly positive integers bounded by the generator's `size`
parameter."
(fmap inc nat))

(def s-neg-int
"Generate strictly negative integers bounded by the generator's `size`
parameter."
(fmap dec neg-int))

=== Suggestions ===

Instead of using fmap, use such-that to remove the 0 value?



 Comments   
Comment by Jay A. Patel [ 22/Jan/15 12:24 AM ]

I didn't change the priority value. Not a major issue for me.





Generated at Mon Jan 26 14:31:26 CST 2015 using JIRA 4.4#649-r158309.