MCPcopy Create free account
hub / github.com/GopherML/bag / Test_circularBuffer_ForEach

Function Test_circularBuffer_ForEach

circularbuffer_test.go:67–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func Test_circularBuffer_ForEach(t *testing.T) {
68 type fields struct {
69 size int
70 }
71
72 type args struct {
73 values []int
74 hasBreak bool
75 }
76
77 type testcase struct {
78 name string
79 fields fields
80 args args
81
82 want []int
83 wantBreak bool
84 }
85
86 tests := []testcase{
87 {
88 name: "basic",
89 fields: fields{
90 size: 3,
91 },
92 args: args{
93 values: []int{1, 2, 3},
94 },
95 want: []int{1, 2, 3},
96 },
97 {
98 name: "not full",
99 fields: fields{
100 size: 3,
101 },
102 args: args{
103 values: []int{1, 2},
104 },
105 want: []int{1, 2},
106 },
107 {
108 name: "with partial popped",
109 fields: fields{
110 size: 3,
111 },
112 args: args{
113 values: []int{1, 2, 3, 4, 5},
114 },
115 want: []int{3, 4, 5},
116 },
117 {
118 name: "with complete popped",
119 fields: fields{
120 size: 3,
121 },
122 args: args{
123 values: []int{1, 2, 3, 4, 5, 6},
124 },

Callers

nothing calls this directly

Calls 2

ShiftMethod · 0.80
ForEachMethod · 0.80

Tested by

no test coverage detected