Skip to content

Commit

Permalink
test(fuzz): update Valid fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jan 12, 2022
1 parent 1da9437 commit 510eda1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package jx

import (
"bytes"
"encoding/json"
"testing"

"github.com/go-faster/errors"
Expand All @@ -22,7 +23,13 @@ func FuzzValid(f *testing.F) {
f.Add([]byte(s))
}
f.Fuzz(func(t *testing.T, data []byte) {
Valid(data)
var (
std = json.Valid(data)
jx = Valid(data)
)
if std != jx {
t.Fatalf(`Valid(%#v): %v (std) != %v (jx)`, string(data), std, jx)
}
})
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go test fuzz v1
[]byte("0E0+0")

0 comments on commit 510eda1

Please sign in to comment.