| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func (r *testReader) Read(buf []byte) (int, error) { |
| for i := 0; i != amount; i++ { |
| buf[i] = charAt(r.off + i) |
| func TestReader(t *testing.T) { |
| pool := NewPool(iobufSize) |
| r := NewReader(pool, &tr) |
| for off := 0; off < loopCount*amount; off += amount { |
| t.Errorf("Unexpected error: %v", err) |
| checkBuf(t, s.Contents, off) |
| for off := amount * loopCount; off != tr.off; off++ { |
| t.Errorf("Unexpected error: %v", err) |
| checkBuf(t, s.Contents, off) |
| t.Errorf("Expected error") |