| 1 | package dstream |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestAddcol1(t *testing.T) { |
| 6 | |
| 7 | x := [][]interface{}{ |
| 8 | { |
| 9 | []float64{0, 0, 0}, |
| 10 | []float64{1, 1}, |
| 11 | []float64{2, 2, 2, 2}, |
| 12 | }, |
| 13 | { |
| 14 | []string{"a", "a", "a"}, |
| 15 | []string{"b", "b"}, |
| 16 | []string{"c", "c", "c", "c"}, |
| 17 | }, |
| 18 | } |
| 19 | na := []string{"x1", "x2"} |
| 20 | da := NewFromArrays(x, na) |
| 21 | |
| 22 | x = append(x, |
| 23 | []interface{}{ |
| 24 | []float64{1, 2, 3}, |
| 25 | []float64{4, 5}, |
| 26 | []float64{6, 7, 8, 9}, |
| 27 | }) |
| 28 | na = append(na, "x3") |
| 29 | db := NewFromArrays(x, na) |
| 30 | |
| 31 | z3 := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9} |
| 32 | |
| 33 | dm := AddCol(da, z3, "x3") |
| 34 | |
| 35 | if !EqualReport(dm, db, true) { |
| 36 | t.Fail() |
| 37 | } |
| 38 | } |