2023-09-05 10:55:01 +02:00
|
|
|
package table
|
|
|
|
|
|
|
|
import (
|
2023-09-14 13:45:18 +02:00
|
|
|
"os"
|
2023-09-05 10:55:01 +02:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewTablePrinter(t *testing.T) {
|
2023-09-14 13:45:18 +02:00
|
|
|
if got := NewTablePrinter(os.Stdout); got == nil {
|
2023-09-05 10:55:01 +02:00
|
|
|
t.Errorf("NewTablePrinter() return nill")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_rowsLength(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
length int
|
|
|
|
want bool
|
|
|
|
}{{
|
|
|
|
name: "0",
|
|
|
|
length: 0,
|
|
|
|
want: false,
|
|
|
|
}, {
|
|
|
|
name: "10",
|
|
|
|
length: 10,
|
|
|
|
want: false,
|
|
|
|
}, {
|
|
|
|
name: "11",
|
|
|
|
length: 11,
|
|
|
|
want: true,
|
|
|
|
}, {
|
|
|
|
name: "20",
|
|
|
|
length: 20,
|
|
|
|
want: true,
|
|
|
|
}}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
if got := rowsLength(tt.length); got != tt.want {
|
|
|
|
t.Errorf("rowsLength() = %v, want %v", got, tt.want)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|