git » chasquid » commit 4e2e378

normalize: Fuzz testing

author Alberto Bertogli
2017-04-25 21:14:28 UTC
committer Alberto Bertogli
2018-03-30 21:35:08 UTC
parent 9f603da8de42bed7ce7151c9d15e6a2bd6ae34c1

normalize: Fuzz testing

internal/normalize/fuzz.go +15 -0
internal/normalize/testdata/fuzz/corpus/t-001 +1 -0
internal/normalize/testdata/fuzz/corpus/t-002 +1 -0
internal/normalize/testdata/fuzz/corpus/t-003 +1 -0
internal/normalize/testdata/fuzz/corpus/t-004 +1 -0
internal/normalize/testdata/fuzz/corpus/t-005 +1 -0

diff --git a/internal/normalize/fuzz.go b/internal/normalize/fuzz.go
new file mode 100644
index 0000000..8c1e7c8
--- /dev/null
+++ b/internal/normalize/fuzz.go
@@ -0,0 +1,15 @@
+// Fuzz testing for package normalize.
+
+// +build gofuzz
+
+package normalize
+
+func Fuzz(data []byte) int {
+	s := string(data)
+	User(s)
+	Domain(s)
+	Addr(s)
+	DomainToUnicode(s)
+
+	return 0
+}
diff --git a/internal/normalize/testdata/fuzz/corpus/t-001 b/internal/normalize/testdata/fuzz/corpus/t-001
new file mode 100644
index 0000000..96051d5
--- /dev/null
+++ b/internal/normalize/testdata/fuzz/corpus/t-001
@@ -0,0 +1 @@
+ñandú
\ No newline at end of file
diff --git a/internal/normalize/testdata/fuzz/corpus/t-002 b/internal/normalize/testdata/fuzz/corpus/t-002
new file mode 100644
index 0000000..cb14e88
--- /dev/null
+++ b/internal/normalize/testdata/fuzz/corpus/t-002
@@ -0,0 +1 @@
+ÑAndÚ
\ No newline at end of file
diff --git a/internal/normalize/testdata/fuzz/corpus/t-003 b/internal/normalize/testdata/fuzz/corpus/t-003
new file mode 100644
index 0000000..aadcd49
--- /dev/null
+++ b/internal/normalize/testdata/fuzz/corpus/t-003
@@ -0,0 +1 @@
+Pingüino
\ No newline at end of file
diff --git a/internal/normalize/testdata/fuzz/corpus/t-004 b/internal/normalize/testdata/fuzz/corpus/t-004
new file mode 100644
index 0000000..f12809b
--- /dev/null
+++ b/internal/normalize/testdata/fuzz/corpus/t-004
@@ -0,0 +1 @@
+pé@léa
\ No newline at end of file
diff --git a/internal/normalize/testdata/fuzz/corpus/t-005 b/internal/normalize/testdata/fuzz/corpus/t-005
new file mode 100644
index 0000000..23dab25
--- /dev/null
+++ b/internal/normalize/testdata/fuzz/corpus/t-005
@@ -0,0 +1 @@
+henryⅣ@throne
\ No newline at end of file