MCPcopy
hub / github.com/tidwall/gjson / TestValidRandom

Function TestValidRandom

gjson_test.go:1111–1127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1109}
1110
1111func TestValidRandom(t *testing.T) {
1112 rand.Seed(time.Now().UnixNano())
1113 b := make([]byte, 100000)
1114 start := time.Now()
1115 for time.Since(start) < time.Second*3 {
1116 n := rand.Int() % len(b)
1117 rand.Read(b[:n])
1118 validpayload(b[:n], 0)
1119 }
1120
1121 start = time.Now()
1122 for time.Since(start) < time.Second*3 {
1123 n := rand.Int() % len(b)
1124 makeRandomJSONChars(b[:n])
1125 validpayload(b[:n], 0)
1126 }
1127}
1128
1129func TestGetMany47(t *testing.T) {
1130 json := `{"bar": {"id": 99, "mybar": "my mybar" }, "foo": ` +

Callers

nothing calls this directly

Calls 3

validpayloadFunction · 0.85
makeRandomJSONCharsFunction · 0.85
IntMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…