-
Notifications
You must be signed in to change notification settings - Fork 283
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
keyformat, internal: add fuzzers #762
Conversation
func TestRandStrHuge(t *testing.T) { | ||
_ = RandStr(8455134228352958140) | ||
} | ||
|
||
func FuzzRandStr(f *testing.F) { | ||
// 1. Seed the fuzzer with lengths. | ||
mr := mrand.New(mrand.NewSource(10)) | ||
for i := 0; i < 100; i++ { | ||
f.Add(mr.Int()) | ||
} | ||
|
||
// 2. Now run the fuzzer. | ||
rr := NewRand() | ||
f.Fuzz(func(t *testing.T, n int) { | ||
s := rr.Str(n) | ||
// Ensure that we've got alphanumeric sequences entirely. | ||
for _, c := range s { | ||
switch { | ||
case c >= '0' && c <= '9': | ||
case c >= 'a' && c <= 'z': | ||
case c >= 'A' && c <= 'Z': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please delete, we dont need to fuzz test helpers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll remove it.
Adds fuzzers that have discovered some bugs, like: * cosmos#760 * cosmos#761
16b2434
to
7e46b88
Compare
Closing this PR since RandStr is deemed to be an internal function only used in tests. |
Adds fuzzers that have discovered some bugs, like:
/cc @elias-orijtech @tac0turtle