Skip to content

Commit

Permalink
Add fuzzing test
Browse files Browse the repository at this point in the history
Signed-off-by: John Howard <[email protected]>
  • Loading branch information
howardjohn committed May 16, 2023
1 parent 87f8876 commit 4844bbf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions v2/fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package jsonpatch_test

import (
"testing"

"gomodules.xyz/jsonpatch/v2"
)

func FuzzCreatePatch(f *testing.F) {
add := func(a, b string) {
f.Add([]byte(a), []byte(b))
}
add(simpleA, simpleB)
add(superComplexBase, superComplexA)
add(hyperComplexBase, hyperComplexA)
add(arraySrc, arrayDst)
add(empty, simpleA)
add(point, lineString)
f.Fuzz(func(t *testing.T, a, b []byte) {
_, _ = jsonpatch.CreatePatch(a, b)
})
}

0 comments on commit 4844bbf

Please sign in to comment.