MCPcopy
hub / github.com/gogo/protobuf / TestNinOptStructJSON

Function TestNinOptStructJSON

test/thetestpb_test.go:5203–5223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5201 }
5202}
5203func TestNinOptStructJSON(t *testing.T) {
5204 seed := time.Now().UnixNano()
5205 popr := math_rand.New(math_rand.NewSource(seed))
5206 p := NewPopulatedNinOptStruct(popr, true)
5207 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
5208 jsondata, err := marshaler.MarshalToString(p)
5209 if err != nil {
5210 t.Fatalf("seed = %d, err = %v", seed, err)
5211 }
5212 msg := &NinOptStruct{}
5213 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
5214 if err != nil {
5215 t.Fatalf("seed = %d, err = %v", seed, err)
5216 }
5217 if err := p.VerboseEqual(msg); err != nil {
5218 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
5219 }
5220 if !p.Equal(msg) {
5221 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
5222 }
5223}
5224func TestNidRepStructJSON(t *testing.T) {
5225 seed := time.Now().UnixNano()
5226 popr := math_rand.New(math_rand.NewSource(seed))

Callers

nothing calls this directly

Calls 4

MarshalToStringMethod · 0.95
NewPopulatedNinOptStructFunction · 0.70
VerboseEqualMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…