MCPcopy
hub / github.com/kopia/kopia / TestGatherBytes

Function TestGatherBytes

internal/gather/gather_bytes_test.go:27–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestGatherBytes(t *testing.T) {
28 // split the 'whole' into equivalent Bytes slices in some interesting ways
29 cases := []struct {
30 whole []byte
31 sliced Bytes
32 }{
33 {
34 whole: []byte{},
35 sliced: Bytes{},
36 },
37 {
38 whole: []byte{},
39 sliced: Bytes{Slices: [][]byte{
40 nil,
41 }},
42 },
43 {
44 whole: []byte{},
45 sliced: Bytes{Slices: [][]byte{
46 nil,
47 {},
48 nil,
49 }},
50 },
51 {
52 whole: sample1,
53 sliced: FromSlice(sample1),
54 },
55 {
56 whole: sample1,
57 sliced: Bytes{Slices: [][]byte{
58 nil,
59 sample1,
60 nil,
61 }},
62 },
63 {
64 whole: sample1,
65 sliced: Bytes{Slices: [][]byte{
66 sample1[0:20],
67 sample1[20:],
68 }},
69 },
70 {
71 whole: sample1,
72 sliced: Bytes{Slices: [][]byte{
73 sample1[0:20],
74 nil, // zero-length
75 {}, // zero-length
76 sample1[20:],
77 }},
78 },
79 {
80 whole: sample1,
81 sliced: Bytes{Slices: [][]byte{
82 sample1[0:10],
83 sample1[10:25],
84 sample1[25:30],

Callers

nothing calls this directly

Calls 12

CloseMethod · 0.95
ToByteSliceMethod · 0.95
ResetMethod · 0.95
FromSliceFunction · 0.85
ErrorfMethod · 0.80
EqualMethod · 0.80
LengthMethod · 0.65
ReaderMethod · 0.65
WriteToMethod · 0.65
ErrorMethod · 0.65
ToByteSliceMethod · 0.45
AppendSectionToMethod · 0.45

Tested by

no test coverage detected