-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from mattfarina/fuzzing
Adding fuzzing for v3
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_fuzz/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// +build gofuzz | ||
|
||
package semver | ||
|
||
func Fuzz(data []byte) int { | ||
d := string(data) | ||
|
||
// Test NewVersion | ||
_, _ = NewVersion(d) | ||
|
||
// Test StrictNewVersion | ||
_, _ = StrictNewVersion(d) | ||
|
||
// Test NewConstraint | ||
_, _ = NewConstraint(d) | ||
|
||
// The return value should be 0 normally, 1 if the priority in future tests | ||
// should be increased, and -1 if future tests should skip passing in that | ||
// data. We do not have a reason to change priority so 0 is always returned. | ||
// There are example tests that do this. | ||
return 0 | ||
} |