36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
-
+
|
}
}
}
func TestWriterReader(t *testing.T) {
var (
buf bytes.Buffer
w io.Writer = Writer(&buf)
w io.Writer = Encoder(&buf)
input []byte = make([]byte, 256)
fib Numbers = New(16)
)
for i := uint64(0); i < 256; i++ {
input[i] = byte(i)
}
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
-
+
|
t.Fatal("Unexpected location for", i, "value", vs)
}
output = output[len(vs):]
}
var (
in *bytes.Reader = bytes.NewReader(buf.Bytes())
r io.Reader = Reader(in)
r io.Reader = Decoder(in)
out bytes.Buffer
)
io.Copy(&out, r)
decoded := out.Bytes()
delta := diff.Diff(diff.D{Len1: len(decoded), Len2: len(input), EqualFunc: func(i, j int) bool {
return decoded[i] == input[j]
|