Comments (2)
Yes, NilChance
doesn't affect string length.
You should make a custom fuzz func, either for string or for the structure containing the string. e.g.,
f := fuzz.New().Funcs(
func(o *MyStruct, c fuzz.Continue) {
c.FuzzNoCustom(o) // Make an ordinary fuzz pass without calling the custom fuzz functions
for o.MyString == "" { c.Fuzz(&o.MyString) }
})
Chances are, if your string must not be empty, there's some other qualities you may want to enforce on it as well.
It's often valuable to run your code over invalid inputs, depending on your situation, to make sure it doesn't do something really bad. Custom fuzz functions in my view are mostly about adjusting the probability of invalid input. E.g., if you've got 20 strings with this requirement, then nearly all of the time at least one of them will be blank, and the fuzzer will almost never test your success path.
from gofuzz.
I see, thank you for the suggestions and code sample! I will close this issue since it was a misunderstanding on my part.
from gofuzz.
Related Issues (20)
- Improve quality of integer output HOT 2
- Idea: Fuzzing with only non-zero values?
- Add golint to automated tests
- comparison with go-fuzz HOT 1
- presence of an interface value always panics HOT 20
- issue building with go 1.11.3 and previous
- Is this repository still alive? HOT 1
- go mod checksum mismatch HOT 1
- Integrate with fuzzit?
- Add note to docs that private fields of structs cannot be fuzzed using this package HOT 2
- go-fuzz integration may give nil values despite NilChance(0) HOT 2
- New Release? HOT 2
- UnicodeRanges as shown in example cause `go vet` to fail
- Test failure on 32 bits arch
- NewFromGoFuzz doesn't work well with go-fuzz HOT 1
- Can we add support for unexported field? HOT 2
- Is / should gofuzz safe for concurrent use? HOT 2
- Tag a new release: 1.3.0
- Regarding newer versions
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 gofuzz.