| 8 | ) |
| 9 | |
| 10 | func TestCreateDataTable(t *testing.T) { |
| 11 | data := new(DataTable) |
| 12 | |
| 13 | data.AddColumn("Gender") |
| 14 | data.AddColumn("Age") |
| 15 | |
| 16 | if len(data.columns) != 2 { |
| 17 | t.Error("Should be 2 columns") |
| 18 | } |
| 19 | |
| 20 | if data.columns[1] != "Age" { |
| 21 | t.Error("Should have proper column name") |
| 22 | } |
| 23 | |
| 24 | data.AddRow(1, 5) |
| 25 | data.AddRow(0, 4) |
| 26 | |
| 27 | if len(data.rows) != 2 { |
| 28 | t.Error("Should have 2 rows") |
| 29 | } |
| 30 | |
| 31 | if data.rows[1][0] != 0 && data.rows[1][1] != 4 { |
| 32 | t.Error("Row should be properly inserted") |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func TestLineChartIndependent(t *testing.T) { |
| 37 | fmt.Print("Independent charts\n\n") |