diff options
author | EuAndreh <eu@euandre.org> | 2025-05-07 07:02:57 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-05-07 07:16:33 -0300 |
commit | d3cb41376ac0be31ed2b6649dd8d6b42674ebeaf (patch) | |
tree | df7eeb84a91114b6624a0f0fe7c1b11fa7e5ae1f /tests/fuzz | |
parent | tests/{cli-opts,integration}.sh: Add test implementations (diff) | |
download | uuid-d3cb41376ac0be31ed2b6649dd8d6b42674ebeaf.tar.gz uuid-d3cb41376ac0be31ed2b6649dd8d6b42674ebeaf.tar.xz |
Support UUIDv7, with -vN for choosing
Diffstat (limited to 'tests/fuzz')
l--------- | tests/fuzz/new-v4-from/main.go (renamed from tests/fuzz/new-from/main.go) | 0 | ||||
-rw-r--r-- | tests/fuzz/new-v4-from/uuid.go (renamed from tests/fuzz/new-from/uuid.go) | 2 | ||||
l--------- | tests/fuzz/new-v7-from/main.go | 1 | ||||
-rw-r--r-- | tests/fuzz/new-v7-from/uuid.go | 33 |
4 files changed, 35 insertions, 1 deletions
diff --git a/tests/fuzz/new-from/main.go b/tests/fuzz/new-v4-from/main.go index f67563d..f67563d 120000 --- a/tests/fuzz/new-from/main.go +++ b/tests/fuzz/new-v4-from/main.go diff --git a/tests/fuzz/new-from/uuid.go b/tests/fuzz/new-v4-from/uuid.go index 298687b..90cc994 100644 --- a/tests/fuzz/new-from/uuid.go +++ b/tests/fuzz/new-v4-from/uuid.go @@ -11,7 +11,7 @@ import ( func fn(f *testing.F) { f.Fuzz(func(t *testing.T, payload []byte) { - NewFrom(bytes.NewReader(payload)) + NewV4From(bytes.NewReader(payload)) }) } diff --git a/tests/fuzz/new-v7-from/main.go b/tests/fuzz/new-v7-from/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/fuzz/new-v7-from/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/fuzz/new-v7-from/uuid.go b/tests/fuzz/new-v7-from/uuid.go new file mode 100644 index 0000000..8686ebf --- /dev/null +++ b/tests/fuzz/new-v7-from/uuid.go @@ -0,0 +1,33 @@ +package uuid + +import ( + "bytes" + "os" + "testing" + "testing/internal/testdeps" +) + + + +func fn(f *testing.F) { + f.Fuzz(func(t *testing.T, payload []byte, nanosecs uint64) { + NewV7From(bytes.NewReader(payload), func() uint64 { + return nanosecs + }) + }) +} + + + +func MainTest() { + fuzzTargets := []testing.InternalFuzzTarget{ + { "fn", 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()) +} |