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

Function TestNidOptStructJSON

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

Source from the content-addressed store, hash-verified

5180 }
5181}
5182func TestNidOptStructJSON(t *testing.T) {
5183 seed := time.Now().UnixNano()
5184 popr := math_rand.New(math_rand.NewSource(seed))
5185 p := NewPopulatedNidOptStruct(popr, true)
5186 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
5187 jsondata, err := marshaler.MarshalToString(p)
5188 if err != nil {
5189 t.Fatalf("seed = %d, err = %v", seed, err)
5190 }
5191 msg := &NidOptStruct{}
5192 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
5193 if err != nil {
5194 t.Fatalf("seed = %d, err = %v", seed, err)
5195 }
5196 if err := p.VerboseEqual(msg); err != nil {
5197 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
5198 }
5199 if !p.Equal(msg) {
5200 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
5201 }
5202}
5203func TestNinOptStructJSON(t *testing.T) {
5204 seed := time.Now().UnixNano()
5205 popr := math_rand.New(math_rand.NewSource(seed))

Callers

nothing calls this directly

Calls 4

MarshalToStringMethod · 0.95
NewPopulatedNidOptStructFunction · 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…