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

Function TestRandomMany

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

Source from the content-addressed store, hash-verified

929}
930
931func TestRandomMany(t *testing.T) {
932 var lstr string
933 defer func() {
934 if v := recover(); v != nil {
935 println("'" + hex.EncodeToString([]byte(lstr)) + "'")
936 println("'" + lstr + "'")
937 panic(v)
938 }
939 }()
940 rand.Seed(time.Now().UnixNano())
941 b := make([]byte, 512)
942 for i := 0; i < 50000; i++ {
943 n, err := rand.Read(b[:rand.Int()%len(b)])
944 if err != nil {
945 t.Fatal(err)
946 }
947 lstr = string(b[:n])
948 paths := make([]string, rand.Int()%64)
949 for i := range paths {
950 var b []byte
951 n := rand.Int() % 5
952 for j := 0; j < n; j++ {
953 if j > 0 {
954 b = append(b, '.')
955 }
956 nn := rand.Int() % 10
957 for k := 0; k < nn; k++ {
958 b = append(b, 'a'+byte(rand.Int()%26))
959 }
960 }
961 paths[i] = string(b)
962 }
963 GetMany(lstr, paths...)
964 }
965}
966
967var complicatedJSON = `
968{

Callers

nothing calls this directly

Calls 2

GetManyFunction · 0.85
IntMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…