summaryrefslogtreecommitdiff
path: root/tests/fuzz
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-13 07:20:48 -0300
committerEuAndreh <eu@euandre.org>2025-05-13 15:13:17 -0300
commit8f4541232bbe127dd90d0fb9a3278e0636b8cba7 (patch)
tree5c90673d7f7262533044093b4d40bde07982b725 /tests/fuzz
parentsrc/gobang.go: Add Heredoc() (diff)
downloadgobang-8f4541232bbe127dd90d0fb9a3278e0636b8cba7.tar.gz
gobang-8f4541232bbe127dd90d0fb9a3278e0636b8cba7.tar.xz
Revamp Heredoc(), add fuzz to prevent panics
Diffstat (limited to 'tests/fuzz')
-rw-r--r--tests/fuzz/count-leading-chars/gobang.go30
l---------tests/fuzz/count-leading-chars/main.go1
-rw-r--r--tests/fuzz/heredoc/gobang.go30
l---------tests/fuzz/heredoc/main.go1
4 files changed, 62 insertions, 0 deletions
diff --git a/tests/fuzz/count-leading-chars/gobang.go b/tests/fuzz/count-leading-chars/gobang.go
new file mode 100644
index 0000000..5b9736d
--- /dev/null
+++ b/tests/fuzz/count-leading-chars/gobang.go
@@ -0,0 +1,30 @@
+package gobang
+
+import (
+ "os"
+ "testing"
+ "testing/internal/testdeps"
+)
+
+
+
+func fn(f *testing.F) {
+ f.Fuzz(func(t *testing.T, s string, c byte) {
+ countLeadingChar(s, c)
+ })
+}
+
+
+
+func MainTest() {
+ fuzzTargets := []testing.InternalFuzzTarget{
+ { "count-leading-char", fn },
+ }
+
+ deps := testdeps.TestDeps{}
+ tests := []testing.InternalTest {}
+ benchmarks := []testing.InternalBenchmark{}
+ examples := []testing.InternalExample {}
+ m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
+ os.Exit(m.Run())
+}
diff --git a/tests/fuzz/count-leading-chars/main.go b/tests/fuzz/count-leading-chars/main.go
new file mode 120000
index 0000000..f67563d
--- /dev/null
+++ b/tests/fuzz/count-leading-chars/main.go
@@ -0,0 +1 @@
+../../main.go \ No newline at end of file
diff --git a/tests/fuzz/heredoc/gobang.go b/tests/fuzz/heredoc/gobang.go
new file mode 100644
index 0000000..e4cb9c6
--- /dev/null
+++ b/tests/fuzz/heredoc/gobang.go
@@ -0,0 +1,30 @@
+package gobang
+
+import (
+ "os"
+ "testing"
+ "testing/internal/testdeps"
+)
+
+
+
+func fn(f *testing.F) {
+ f.Fuzz(func(t *testing.T, s string) {
+ Heredoc(s)
+ })
+}
+
+
+
+func MainTest() {
+ fuzzTargets := []testing.InternalFuzzTarget{
+ { "heredoc", fn },
+ }
+
+ deps := testdeps.TestDeps{}
+ tests := []testing.InternalTest {}
+ benchmarks := []testing.InternalBenchmark{}
+ examples := []testing.InternalExample {}
+ m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
+ os.Exit(m.Run())
+}
diff --git a/tests/fuzz/heredoc/main.go b/tests/fuzz/heredoc/main.go
new file mode 120000
index 0000000..f67563d
--- /dev/null
+++ b/tests/fuzz/heredoc/main.go
@@ -0,0 +1 @@
+../../main.go \ No newline at end of file