Debian Codegraph @

dstream/center_test.go

raw symbols SCIP
1 package dstream
2
3 import "testing"
4
5 func TestCenter1(t *testing.T) {
6
7 x0 := []interface{}{
8 []float64{5, 8, 1},
9 []float64{2, 1, 3, 1},
10 }
11 x1 := []interface{}{
12 []float64{5, 8, 1},
13 []float64{2, 1, 3, 1},
14 }
15 x2 := []interface{}{
16 []float64{2, 3, 4},
17 []float64{1, 2, 1, 1},
18 }
19 x3 := []interface{}{
20 []float64{4, 1, 2},
21 []float64{0, 1, 1, 0},
22 }
23 da := NewFromArrays([][]interface{}{x0, x1, x2, x3}, []string{"x0", "x1", "x2", "x3"})
24
25 dx := Center(da, "x1", "x2")
26
27 x1 = []interface{}{
28 []float64{2, 5, -2},
29 []float64{-1, -2, 0, -2},
30 }
31 x2 = []interface{}{
32 []float64{0, 1, 2},
33 []float64{-1, 0, -1, -1},
34 }
35 db := NewFromArrays([][]interface{}{x0, x1, x2, x3}, []string{"x0", "x1", "x2", "x3"})
36
37 for j := 0; j < 2; j++ {
38 if !EqualReport(dx, db, true) {
39 t.Fail()
40 }
41 dx = MemCopy(dx, true)
42 }
43 }