(t *testing.T)
| 228 | } |
| 229 | |
| 230 | func TestReadBoolBytes(t *testing.T) { |
| 231 | var buf bytes.Buffer |
| 232 | en := NewWriter(&buf) |
| 233 | |
| 234 | tests := []bool{true, false} |
| 235 | |
| 236 | for i, v := range tests { |
| 237 | buf.Reset() |
| 238 | en.WriteBool(v) |
| 239 | en.Flush() |
| 240 | out, left, err := ReadBoolBytes(buf.Bytes()) |
| 241 | if err != nil { |
| 242 | t.Errorf("test case %d: %s", i, err) |
| 243 | } |
| 244 | |
| 245 | if len(left) != 0 { |
| 246 | t.Errorf("expected 0 bytes left; found %d", len(left)) |
| 247 | } |
| 248 | |
| 249 | if out != v { |
| 250 | t.Errorf("%t in; %t out", v, out) |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | func BenchmarkReadBoolBytes(b *testing.B) { |
| 256 | buf := []byte{mtrue, mfalse, mtrue, mfalse} |
nothing calls this directly
no test coverage detected
searching dependent graphs…