From 9b3458e7d263b1535716ed30e27e6507ee9b3c91 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 18 Oct 2024 08:52:08 -0300 Subject: Add baseline functional test, fuzz target and benchmark --- tests/fuzz/api/scrypt.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/fuzz/api/scrypt.go (limited to 'tests/fuzz/api/scrypt.go') diff --git a/tests/fuzz/api/scrypt.go b/tests/fuzz/api/scrypt.go new file mode 100644 index 0000000..eb29d2d --- /dev/null +++ b/tests/fuzz/api/scrypt.go @@ -0,0 +1,37 @@ +package scrypt + +import ( + "os" + "testing" + "testing/internal/testdeps" +) + + + +func api(f *testing.F) { + f.Fuzz(func(t *testing.T, password []byte, salt []byte) { + if len(salt) < saltMinLength { + return + } + + _, err := Hash(password, salt) + if err != nil { + t.Errorf("Failed on: %#v\n", err) + } + }) +} + + + +func MainTest() { + fuzzTargets := []testing.InternalFuzzTarget{ + { "api", api }, + } + + deps := testdeps.TestDeps{} + tests := []testing.InternalTest {} + benchmarks := []testing.InternalBenchmark{} + examples := []testing.InternalExample {} + m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples) + os.Exit(m.Run()) +} -- cgit v1.2.3