43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
delta := diff.Diff(diff.D{len(input), len(output),
func(i, j int) bool { return input[i] == output[j] }})
if len(delta.Added) > 0 || len(delta.Removed) > 0 {
t.Error("Differences detected ", delta)
}
}
func TestMinReader(t *testing.T) {
var (
input []byte = []byte{0, 1, 2, 3, 4, 5, 6, 7}
output []byte = make([]byte, 16)
reader *bytes.Reader = bytes.NewReader(input)
min io.Reader = MinReader(reader, 4)
)
// Expecting a read count of 2
count, err := min.Read(output[:2])
if count != 2 {
t.Error("Invalid read count from MinReader", count)
}
|
|
|
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
delta := diff.Diff(diff.D{len(input), len(output),
func(i, j int) bool { return input[i] == output[j] }})
if len(delta.Added) > 0 || len(delta.Removed) > 0 {
t.Error("Differences detected ", delta)
}
}
func TestBlockReader(t *testing.T) {
var (
input []byte = []byte{0, 1, 2, 3, 4, 5, 6, 7}
output []byte = make([]byte, 16)
reader *bytes.Reader = bytes.NewReader(input)
min io.Reader = BlockReader(reader, 4)
)
// Expecting a read count of 2
count, err := min.Read(output[:2])
if count != 2 {
t.Error("Invalid read count from MinReader", count)
}
|