TestPartitionAt2 tests ability to read at various offsets from buffer previously written.
(t *testing.T)
| 864 | |
| 865 | // TestPartitionAt2 tests ability to read at various offsets from buffer previously written. |
| 866 | func TestPartitionAt2(t *testing.T) { |
| 867 | buf := NewPartitionAt(NewMemPoolAt(5)) |
| 868 | buf.Write([]byte("Hello World")) |
| 869 | data := make([]byte, 2) |
| 870 | n, _ := buf.ReadAt(data, 2) |
| 871 | if !bytes.Equal(data[:n], []byte("ll")) { |
| 872 | t.Error("Read Failed. " + string(data[:n])) |
| 873 | } |
| 874 | n, _ = buf.ReadAt(data, 4) |
| 875 | if !bytes.Equal(data[:n], []byte("o ")) { |
| 876 | t.Error("Read Failed. " + string(data[:n])) |
| 877 | } |
| 878 | n, _ = buf.ReadAt(data, 10) |
| 879 | if !bytes.Equal(data[:n], []byte("d")) { |
| 880 | t.Error("Read Failed. " + string(data[:n])) |
| 881 | } |
| 882 | n, _ = buf.ReadAt(data, 100) |
| 883 | if !bytes.Equal(data[:n], []byte{}) { |
| 884 | t.Error("Read Failed. " + string(data[:n])) |
| 885 | } |
| 886 | |
| 887 | buf.Reset() |
| 888 | checkCap(t, buf, math.MaxInt64) |
| 889 | runPerfectSeries(t, buf) |
| 890 | } |
| 891 | |
| 892 | // TestPartitionAt3 tests ability to overwrite buffer previously written. |
| 893 | func TestPartitionAt3(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…