Added Cursor.At test
This commit is contained in:
@ -73,7 +73,17 @@ func testCursor[C cursor.Cursor[byte]](t *testing.T, makeCursor func([]byte) C)
|
||||
test.ErrorIs(t, err, io.EOF)
|
||||
test.EqOp(t, len(data), int(n))
|
||||
}))
|
||||
t.Run("At", Todo)
|
||||
t.Run("At sets cursor position", rapid.MakeCheck(func(t *rapid.T) {
|
||||
data := rapid.SliceOfN(rapid.Byte(), 1, 100).Draw(t, "data")
|
||||
pos := rapid.Uint64Range(0, uint64(len(data)-1)).Draw(t, "pos")
|
||||
c := makeCursor(data).At(pos)
|
||||
|
||||
dst := make([]byte, 1)
|
||||
n, _, err := c.Read(dst)
|
||||
test.EqOp(t, 1, n)
|
||||
test.NoError(t, err)
|
||||
test.EqOp(t, data[pos], dst[0])
|
||||
}))
|
||||
}
|
||||
|
||||
func TestSliceCursor(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user