MCPcopy
hub / github.com/tinylib/msgp / TestTextMarshalerSize

Function TestTextMarshalerSize

_generated/binary_marshaler_test.go:98–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestTextMarshalerSize(t *testing.T) {
99 testType := &TextBinTestType{Value: "test"}
100
101 // Get the size
102 size := testType.Msgsize()
103
104 // Marshal and check the actual size matches estimate
105 data, err := testType.MarshalMsg(nil)
106 if err != nil {
107 t.Fatalf("MarshalMsg failed: %v", err)
108 }
109
110 if len(data) > size {
111 t.Errorf("Msgsize underestimated: estimated %d, actual %d", size, len(data))
112 }
113
114 if size > len(data)+100 { // Allow some reasonable overhead
115 t.Errorf("Msgsize too conservative: estimated %d, actual %d", size, len(data))
116 }
117}
118
119func TestStructWithMarshalerFields(t *testing.T) {
120 // Create a test struct with all field types populated

Callers

nothing calls this directly

Calls 2

MsgsizeMethod · 0.65
MarshalMsgMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…