MCPcopy Index your code
hub / github.com/codechenx/FastTableViewer / TestBuffer_SortByStr

Function TestBuffer_SortByStr

buffer_test.go:152–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func TestBuffer_SortByStr(t *testing.T) {
153 b := createNewBuffer()
154 b.rowFreeze = 1
155 _ = b.contAppendSli([]string{"Name"}, false)
156 _ = b.contAppendSli([]string{"Charlie"}, false)
157 _ = b.contAppendSli([]string{"Alice"}, false)
158 _ = b.contAppendSli([]string{"Bob"}, false)
159
160 b.sortByStr(0, false)
161 if b.cont[1][0] != "Alice" {
162 t.Errorf("After ascending sort, first data row = %s, want Alice", b.cont[1][0])
163 }
164
165 b.sortByStr(0, true)
166 if b.cont[1][0] != "Charlie" {
167 t.Errorf("After descending sort, first data row = %s, want Charlie", b.cont[1][0])
168 }
169}
170
171func TestBuffer_sortByNum(t *testing.T) {
172 type args struct {

Callers

nothing calls this directly

Calls 3

createNewBufferFunction · 0.85
contAppendSliMethod · 0.80
sortByStrMethod · 0.80

Tested by

no test coverage detected