BenchmarkString benchmark the read and write the string.
(t *testing.B)
| 302 | |
| 303 | // BenchmarkString benchmark the read and write the string. |
| 304 | func BenchmarkString(t *testing.B) { |
| 305 | b := NewBuffer() |
| 306 | |
| 307 | for i := 0; i < 200; i++ { |
| 308 | err := b.WriteString("hahahahahahahahahahahahahahahahahahahaha", byte(i)) |
| 309 | if err != nil { |
| 310 | t.Error(err) |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | rb := r(b) |
| 315 | |
| 316 | for i := 0; i < 200; i++ { |
| 317 | var data string |
| 318 | err := rb.ReadString(&data, byte(i), true) |
| 319 | if err != nil { |
| 320 | t.Error(err) |
| 321 | } |
| 322 | if data != "hahahahahahahahahahahahahahahahahahahaha" { |
| 323 | t.Error("no eq.") |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | func TestBuffer_Reset(t *testing.T) { |
| 329 | got := NewBuffer() |
nothing calls this directly
no test coverage detected