1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-05 17:37:03 +00:00

test: Update fuzz tests to use the built-in infrastructure

Go 1.18 supports fuzzing natively, so this patch migrates our fuzzing
tests to make use of it.
This commit is contained in:
Alberto Bertogli
2023-02-05 12:30:25 +00:00
parent a54d81f406
commit efefee9fbb
88 changed files with 246 additions and 470 deletions

View File

@@ -1,16 +0,0 @@
// Fuzz testing for package normalize.
//go:build gofuzz
// +build gofuzz
package normalize
func Fuzz(data []byte) int {
s := string(data)
User(s)
Domain(s)
Addr(s)
DomainToUnicode(s)
return 0
}

View File

@@ -128,3 +128,27 @@ func TestDomainToUnicode(t *testing.T) {
}
}
}
func FuzzUser(f *testing.F) {
f.Fuzz(func(t *testing.T, user string) {
User(user)
})
}
func FuzzDomain(f *testing.F) {
f.Fuzz(func(t *testing.T, domain string) {
Domain(domain)
})
}
func FuzzAddr(f *testing.F) {
f.Fuzz(func(t *testing.T, addr string) {
Addr(addr)
})
}
func FuzzDomainToUnicode(f *testing.F) {
f.Fuzz(func(t *testing.T, addr string) {
DomainToUnicode(addr)
})
}

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ÑAndÚ")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("henryⅣ@throne")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ñandú")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("pé@léa")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("Pingüino")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("henryⅣthrone")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ÑAndÚ")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("péléa")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ñandú")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("Pingüino")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ÑAndÚ")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("henryⅣ@throne")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ñandú")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("pé@léa")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("Pingüino")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("henryⅣthrone")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ÑAndÚ")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("péléa")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("ñandú")

View File

@@ -0,0 +1,2 @@
go test fuzz v1
string("Pingüino")

View File

@@ -1 +0,0 @@
ñandú

View File

@@ -1 +0,0 @@
ÑAndÚ

View File

@@ -1 +0,0 @@
Pingüino

View File

@@ -1 +0,0 @@
pé@léa

View File

@@ -1 +0,0 @@
henryⅣ@throne