(t *testing.T)
| 274 | } |
| 275 | |
| 276 | func TestDetectAllColumnTypes(t *testing.T) { |
| 277 | data := [][]string{ |
| 278 | {"Name", "Age", "Date", "Mixed"}, |
| 279 | {"Alice", "30", "2024-01-15", "Value1"}, |
| 280 | {"Bob", "25", "2024-02-20", "123"}, |
| 281 | {"Charlie", "35", "2024-03-10", "ABC"}, |
| 282 | } |
| 283 | |
| 284 | b, err := createNewBufferWithData(data, false) |
| 285 | if err != nil { |
| 286 | t.Fatalf("Failed to create buffer: %v", err) |
| 287 | } |
| 288 | b.rowFreeze = 1 |
| 289 | |
| 290 | // Detect all column types |
| 291 | b.detectAllColumnTypes() |
| 292 | |
| 293 | // Check detected types |
| 294 | if b.getColType(0) != colTypeStr { |
| 295 | t.Errorf("Column 0 (Name) should be String, got %s", type2name(b.getColType(0))) |
| 296 | } |
| 297 | if b.getColType(1) != colTypeFloat { |
| 298 | t.Errorf("Column 1 (Age) should be Number, got %s", type2name(b.getColType(1))) |
| 299 | } |
| 300 | if b.getColType(2) != colTypeDate { |
| 301 | t.Errorf("Column 2 (Date) should be Date, got %s", type2name(b.getColType(2))) |
| 302 | } |
| 303 | if b.getColType(3) != colTypeStr { |
| 304 | t.Errorf("Column 3 (Mixed) should be String, got %s", type2name(b.getColType(3))) |
| 305 | } |
| 306 | } |
nothing calls this directly
no test coverage detected