You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am generating a tree of nodes. Each node is represented by a Node interface, which has a handful if implementations, each having their own generator. It appears that saying gen().type(Node.class) picks one of the generators with a uniform distribution.
I really like this. However, I would like one of the nodes to be chosen more often than the others. Of course, I can implement this by using Gen.frequency. However, applying this globally would alleviate the need to keep a separate list.
Would it make sense to have an annotation on the generator that determines its frequency, if it's one of many generators to be chosen from? (Maybe this is currently possible, and I haven't figured out how to do it.) If this makes sense to do, I wouldn't mind taking a stab at implementing it.
@jeremyheiler Thanks for your interest - sorry it's taken so long to respond. I could see that this might be useful, but I'm not certain it wouldn't overcomplicate. Can you post an example of what your property-based test might look like before/after your proposed feature?
I am generating a tree of nodes. Each node is represented by a
Node
interface, which has a handful if implementations, each having their own generator. It appears that sayinggen().type(Node.class)
picks one of the generators with a uniform distribution.I really like this. However, I would like one of the nodes to be chosen more often than the others. Of course, I can implement this by using
Gen.frequency
. However, applying this globally would alleviate the need to keep a separate list.Would it make sense to have an annotation on the generator that determines its frequency, if it's one of many generators to be chosen from? (Maybe this is currently possible, and I haven't figured out how to do it.) If this makes sense to do, I wouldn't mind taking a stab at implementing it.
This may be related to #170.
The text was updated successfully, but these errors were encountered: