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

Function TestNidRepStructJSON

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

Source from the content-addressed store, hash-verified

5222 }
5223}
5224func TestNidRepStructJSON(t *testing.T) {
5225 seed := time.Now().UnixNano()
5226 popr := math_rand.New(math_rand.NewSource(seed))
5227 p := NewPopulatedNidRepStruct(popr, true)
5228 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
5229 jsondata, err := marshaler.MarshalToString(p)
5230 if err != nil {
5231 t.Fatalf("seed = %d, err = %v", seed, err)
5232 }
5233 msg := &NidRepStruct{}
5234 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
5235 if err != nil {
5236 t.Fatalf("seed = %d, err = %v", seed, err)
5237 }
5238 if err := p.VerboseEqual(msg); err != nil {
5239 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
5240 }
5241 if !p.Equal(msg) {
5242 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
5243 }
5244}
5245func TestNinRepStructJSON(t *testing.T) {
5246 seed := time.Now().UnixNano()
5247 popr := math_rand.New(math_rand.NewSource(seed))

Callers

nothing calls this directly

Calls 4

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