Debian Codegraph @

dstream/diffchunk_test.go

raw symbols SCIP
1 package dstream
2
3 import "testing"
4
5 func datad1() (Dstream, Dstream) {
6 x1 := []interface{}{
7 []float64{0, 0, 0, 0, 0, 0},
8 []float64{1, 1, 1, 2, 3, 4},
9 []float64{2, 4, 6, 8, 10, 12},
10 }
11 x2 := []interface{}{
12 []float64{0, 0, 1, 2, 3, 4},
13 []float64{1, 2, 2, 2, 2, 1},
14 []float64{3, 3, 3, 3, 3, 3},
15 }
16 x3 := []interface{}{
17 []float64{1, 2, 3, 4, 5, 6},
18 []float64{4, 5, 6, 7, 8, 9},
19 []float64{7, 8, 9, 10, 11, 12},
20 }
21 x4 := []interface{}{
22 []string{"a", "b", "c", "d", "e", "f"},
23 []string{"d", "e", "f", "g", "h", "i"},
24 []string{"g", "h", "i", "j", "k", "l"},
25 }
26 dat := [][]interface{}{x1, x2, x3, x4}
27 na := []string{"x1", "x2", "x3", "x4"}
28 da := NewFromArrays(dat, na)
29
30 x1 = []interface{}{
31 []float64{0, 0, 0, 0},
32 []float64{1, 2, 3, 4},
33 []float64{6, 8, 10, 12},
34 }
35 x1_1 := []interface{}{
36 []float64{0, 0, 0, 0},
37 []float64{0, 1, 1, 1},
38 []float64{2, 2, 2, 2},
39 }
40 x2 = []interface{}{
41 []float64{1, 2, 3, 4},
42 []float64{2, 2, 2, 1},
43 []float64{3, 3, 3, 3},
44 }
45 x2_2 := []interface{}{
46 []float64{1, 0, 0, 0},
47 []float64{-1, 0, 0, -1},
48 []float64{0, 0, 0, 0},
49 }
50 x3 = []interface{}{
51 []float64{3, 4, 5, 6},
52 []float64{6, 7, 8, 9},
53 []float64{9, 10, 11, 12},
54 }
55 x4 = []interface{}{
56 []string{"c", "d", "e", "f"},
57 []string{"f", "g", "h", "i"},
58 []string{"i", "j", "k", "l"},
59 }
60 dat = [][]interface{}{x1, x1_1, x2, x2_2, x3, x4}
61 na = []string{"x1", "x1$d1", "x2", "x2$d2", "x3", "x4"}
62 db := NewFromArrays(dat, na)
63
64 return da, db
65 }
66
67 func TestDiff1(t *testing.T) {
68
69 da, db := datad1()
70 dx := DiffChunk(da, map[string]int{"x1": 1, "x2": 2})
71
72 if !EqualReport(db, dx, true) {
73 t.Fail()
74 }
75 }