-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses the fuzzer of the Go tool chain in [branch dev.fuzz](https://github.com/golang/go/tree/dev.fuzz). See also golang/go#44551 and https://go.googlesource.com/proposal/+/master/design/draft-fuzzing.md
- Loading branch information
Showing
5 changed files
with
39 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,30 @@ | ||
//+build go.dev.fuzz | ||
|
||
package airac | ||
|
||
import ( | ||
"strconv" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
//goland:noinspection GoUnusedExportedFunction | ||
func FuzzFromString(f *testing.F) { | ||
for i := -999; i <= 9999; i++ { | ||
f.Add(strconv.Itoa(i)) | ||
} | ||
|
||
f.Fuzz(func(t *testing.T, s string) { | ||
t.Parallel() | ||
|
||
a, err := FromString(s) | ||
if err != nil { | ||
t.SkipNow() | ||
} | ||
|
||
s2 := a.String() | ||
if strings.TrimSpace(s) != s2 { | ||
t.Errorf("%q != %q", s, s2) | ||
} | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module github.com/jwkohnen/airac | ||
|
||
go 1.12 | ||
go 1.16 |
2 changes: 2 additions & 0 deletions
2
...ta/corpus/FuzzFromString/44ea5456f4caf7ee4b0cb896e30cb4f52cd0e65cd3c1843393c5a535f97c7a6e
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,2 @@ | ||
go test fuzz v1 | ||
string("+911") |
2 changes: 2 additions & 0 deletions
2
...ta/corpus/FuzzFromString/cde16d0f1e64e24bd633e50af05f0e1c4b74934119ed36156d64e32768cbcc4e
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,2 @@ | ||
go test fuzz v1 | ||
string(" 7807") |