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

Function TestInt16

tars/protocol/codec/codec_test.go:79–97  ·  view source on GitHub ↗

TestInt16 tests the read and write of the int16 type.

(t *testing.T)

Source from the content-addressed store, hash-verified

77
78// TestInt16 tests the read and write of the int16 type.
79func TestInt16(t *testing.T) {
80 for tag := 0; tag < 250; tag += 10 {
81 for i := math.MinInt16; i <= math.MaxInt16; i++ {
82 b := NewBuffer()
83 err := b.WriteInt16(int16(i), byte(tag))
84 if err != nil {
85 t.Error(err)
86 }
87 var data int16
88 err = r(b).ReadInt16(&data, byte(tag), true)
89 if err != nil {
90 t.Error(err)
91 }
92 if data != int16(i) {
93 t.Error("no eq.", i)
94 }
95 }
96 }
97}
98
99// TestInt16_2 tests the read and write of the int16 type.
100func TestInt16_2(t *testing.T) {

Callers

nothing calls this directly

Calls 5

WriteInt16Method · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ReadInt16Method · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected