MCPcopy
hub / github.com/TarsCloud/TarsGo / TestInt32

Function TestInt32

tars/protocol/codec/codec_test.go:117–131  ·  view source on GitHub ↗

TestInt32 tests the read and write of the int32 type.

(t *testing.T)

Source from the content-addressed store, hash-verified

115
116// TestInt32 tests the read and write of the int32 type.
117func TestInt32(t *testing.T) {
118 b := NewBuffer()
119 err := b.WriteInt32(int32(-1), byte(10))
120 if err != nil {
121 t.Error(err)
122 }
123 var data int32
124 err = r(b).ReadInt32(&data, byte(10), true)
125 if err != nil {
126 t.Error(err)
127 }
128 if data != -1 {
129 t.Error("no eq.")
130 }
131}
132
133// TestInt32_2 tests the read and write of the int32 type.
134func TestInt32_2(t *testing.T) {

Callers

nothing calls this directly

Calls 5

WriteInt32Method · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ReadInt32Method · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected