Comments (4)
Actually it should be possible to extend the Map resp. FlatMap functions in this way since they already do a lot of reflection.
Would it help if you have something like this:
existingGen.Map(function(value interface{}, params *gopter.GenParms) interface{} {
return <new value derived from value and params>
})
from gopter.
@untoldwind Hm only issue with that is access to the Shrinker
from existingGen
would be lost. Would you be OK with having another interface that passes it thru too? i.e.
existingGen.Map(function(value *gopter.GenResult, params *gopter.GenParms) interface{} {
return <new value derived from value and params>
})
from gopter.
Yes, I think that should be possible, though the refection code in the "Map" function will be ... messy ;)
I'll give it a try once I have an hour or two to focus.
from gopter.
The gen.Map
is now pretty flexible. It accepts any of the following:
func (value string) string // string is just an example here
func (value string, params *gopter.GenParameters) string
func (value string) *gopter.GenResult
func (value string, params *gopter.GenParameters) *gopter.GenResult
func (result *gopter.GenResult) string
func (result *gopter.GenResult, params *gopter.GenParameter) string
func (result *gopter.GenResult) *gopter.GenResult
func (result *gopter.GenResult, params *gopter.GenParameter) *gopter.GenResult
which also makes gen.MapResult
redundant/obsolete.
I think that should cover your case. Just reopen the issue if I missed something.
from gopter.
Related Issues (20)
- cut a new release HOT 1
- How to generate a slice with a range as length? HOT 1
- []Struct with SuchThat clause within a Struct triggers index out of bounds exception on master HOT 2
- properties.Run doesn't stop HOT 7
- Problem Shrinking *time.Time HOT 2
- Not able to generate slice of pointers HOT 1
- Best way to capture tests for regressions HOT 6
- GenCommand: Generating Commands Based On The Current State HOT 1
- Is it dangerous to share references between states? HOT 1
- Initial state of slices are not held for reporting HOT 7
- Generating unique values HOT 2
- Cannot reproduce tests with seed when restarting tests HOT 8
- Stateful testing: Clarification around InititalStateGen and PostConditions HOT 4
- gen.StructStrict, which errors if gens contains keys the target struct does not contain? HOT 3
- Tests failing on master branch HOT 7
- Generating values which depend on each other fails HOT 4
- Getting values outside of range when using gen.IntRange (probably during shrink) HOT 7
- Check paniced when using OneGenOf HOT 1
- Support for generics?
- Arbitraries.GenForType does not support arrays HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gopter.