MCPcopy Create free account
hub / github.com/buger/jsonparser / oracleRandomJSONBytes

Function oracleRandomJSONBytes

reference_oracle_test.go:256–263  ·  view source on GitHub ↗

oracleRandomJSONBytes returns marshaled JSON for a random value, plus the Go value itself (so callers can walk the tree to predict sub-values).

(r *mathrand.Rand, depth int)

Source from the content-addressed store, hash-verified

254// oracleRandomJSONBytes returns marshaled JSON for a random value, plus the
255// Go value itself (so callers can walk the tree to predict sub-values).
256func oracleRandomJSONBytes(r *mathrand.Rand, depth int) ([]byte, interface{}) {
257 v := oracleRandomJSONValue(r, depth)
258 b, err := json.Marshal(v)
259 if err != nil {
260 return []byte(`null`), nil
261 }
262 return b, v
263}
264
265// ---------------------------------------------------------------------------
266// Path picker — walks a random Go value tree to produce a path that EXISTS.

Callers 3

TestOracleGetRoundTripFunction · 0.85
TestOracleSetRoundTripFunction · 0.85

Calls 1

oracleRandomJSONValueFunction · 0.85

Tested by

no test coverage detected