summaryrefslogtreecommitdiff
path: root/tests/fuzz/api/scrypt.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-10-18 08:52:08 -0300
committerEuAndreh <eu@euandre.org>2024-10-18 08:52:08 -0300
commit9b3458e7d263b1535716ed30e27e6507ee9b3c91 (patch)
treef9be1b76127b4b13d17fb4a56961e9fe89080ab2 /tests/fuzz/api/scrypt.go
parentMakefile: Add suport for functional tests, fuzzing and benchmarks (diff)
downloadscrypt-9b3458e7d263b1535716ed30e27e6507ee9b3c91.tar.gz
scrypt-9b3458e7d263b1535716ed30e27e6507ee9b3c91.tar.xz
Add baseline functional test, fuzz target and benchmark
Diffstat (limited to '')
-rw-r--r--tests/fuzz/api/scrypt.go37
1 files changed, 37 insertions, 0 deletions
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())
+}