MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestBuffer_sortByStr

Function TestBuffer_sortByStr

buffer_test.go:127–150  ·  view source on GitHub ↗

======================================== Buffer Sorting Tests ========================================

(t *testing.T)

Source from the content-addressed store, hash-verified

125// ========================================
126
127func TestBuffer_sortByStr(t *testing.T) {
128 type args struct {
129 colIndex int
130 rev bool
131 }
132 testBuffer, _ := createNewBufferWithData([][]string{{"a", "b", "c"}, {"2", "2", "3"}, {"4", "5", "6"}, {"10", "8", "9"}}, true)
133 wantBuffer, _ := createNewBufferWithData([][]string{{"a", "b", "c"}, {"10", "8", "9"}, {"2", "2", "3"}, {"4", "5", "6"}}, true)
134 tests := []struct {
135 name string
136 b *Buffer
137 args args
138 want *Buffer
139 }{
140 {"String sort ascending", testBuffer, args{colIndex: 0, rev: false}, wantBuffer},
141 }
142 for _, tt := range tests {
143 t.Run(tt.name, func(t *testing.T) {
144 tt.b.sortByStr(tt.args.colIndex, tt.args.rev)
145 if !reflect.DeepEqual(tt.b, tt.want) {
146 t.Errorf("Buffer_sortByStr() = %v, want %v", tt.b, tt.want)
147 }
148 })
149 }
150}
151
152func TestBuffer_SortByStr(t *testing.T) {
153 b := createNewBuffer()

Callers

nothing calls this directly

Calls 2

createNewBufferWithDataFunction · 0.85
sortByStrMethod · 0.80

Tested by

no test coverage detected