======================================== Buffer Sorting Tests ========================================
(t *testing.T)
| 125 | // ======================================== |
| 126 | |
| 127 | func 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 | |
| 152 | func TestBuffer_SortByStr(t *testing.T) { |
| 153 | b := createNewBuffer() |
nothing calls this directly
no test coverage detected