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

Function Test_checkVisible

io_test.go:312–351  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

310}
311
312func Test_checkVisible(t *testing.T) {
313 type args struct {
314 showNumL []int
315 hideNumL []int
316 col int
317 }
318 tests := []struct {
319 name string
320 args args
321 want bool
322 wantErr bool
323 }{
324 {"Show list col 5", args{[]int{1, 3, 5}, []int{}, 5}, false, false},
325 {"Show list col 4", args{[]int{1, 3, 5}, []int{}, 4}, true, false},
326 {"Show list col 3", args{[]int{1, 3, 5}, []int{}, 3}, false, false},
327 {"Show list col 2", args{[]int{1, 3, 5}, []int{}, 2}, true, false},
328 {"Show list col 1", args{[]int{1, 3, 5}, []int{}, 1}, false, false},
329 {"Show list col 0", args{[]int{1, 3, 5}, []int{}, 0}, true, false},
330 {"Hide list col 5", args{[]int{}, []int{1, 3, 5}, 5}, true, false},
331 {"Hide list col 4", args{[]int{}, []int{1, 3, 5}, 4}, false, false},
332 {"Hide list col 3", args{[]int{}, []int{1, 3, 5}, 3}, true, false},
333 {"Hide list col 2", args{[]int{}, []int{1, 3, 5}, 2}, false, false},
334 {"Hide list col 1", args{[]int{}, []int{1, 3, 5}, 1}, true, false},
335 {"Hide list col 0", args{[]int{}, []int{1, 3, 5}, 0}, false, false},
336 {"Both lists error", args{[]int{1, 3, 5}, []int{1, 3, 5}, 4}, false, true},
337 {"No lists all visible", args{[]int{}, []int{}, 3}, true, false},
338 }
339 for _, tt := range tests {
340 t.Run(tt.name, func(t *testing.T) {
341 got, err := checkVisible(tt.args.showNumL, tt.args.hideNumL, tt.args.col)
342 if (err != nil) != tt.wantErr {
343 t.Errorf("checkVisible() error = %v, wantErr %v", err, tt.wantErr)
344 return
345 }
346 if got != tt.want {
347 t.Errorf("checkVisible() = %v, want %v", got, tt.want)
348 }
349 })
350 }
351}
352
353// ========================================
354// CSV Parsing Tests

Callers

nothing calls this directly

Calls 1

checkVisibleFunction · 0.85

Tested by

no test coverage detected