(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestProtobufSerialezer_Serialize(t *testing.T) { |
| 11 | m := &testdata.Ping{Content: "hello"} |
| 12 | s := NewSerializer() |
| 13 | |
| 14 | b, err := s.Marshal(m) |
| 15 | if err != nil { |
| 16 | t.Error(err) |
| 17 | } |
| 18 | |
| 19 | m1 := &testdata.Ping{} |
| 20 | if err := s.Unmarshal(b, m1); err != nil { |
| 21 | t.Fatalf("unmarshal failed: %v", err) |
| 22 | } |
| 23 | // refer: https://developers.google.com/protocol-buffers/docs/reference/go/faq#deepequal |
| 24 | if !proto.Equal(m, m1) { |
| 25 | t.Fail() |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | func BenchmarkSerializer_Serialize(b *testing.B) { |
| 30 | m := &testdata.Ping{Content: "hello"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…