(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func TestVarstring31(t *testing.T) { |
| 144 | s := []byte{10, 11, 12} |
| 145 | b := new(bytes.Buffer) |
| 146 | _, err := WriteVarstr31(b, s) |
| 147 | if err != nil { |
| 148 | t.Fatal(err) |
| 149 | } |
| 150 | want := []byte{3, 10, 11, 12} |
| 151 | if !bytes.Equal(b.Bytes(), want) { |
| 152 | t.Errorf("got %x, want %x", b.Bytes(), want) |
| 153 | } |
| 154 | s, err = ReadVarstr31(NewReader(want)) |
| 155 | if err != nil { |
| 156 | t.Fatal(err) |
| 157 | } |
| 158 | want = []byte{10, 11, 12} |
| 159 | if !bytes.Equal(s, want) { |
| 160 | t.Errorf("got %x, expected %x", s, want) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | func TestEmptyVarstring31(t *testing.T) { |
| 165 | s := []byte{} |
nothing calls this directly
no test coverage detected