Debian Codegraph @

build/cartesian_test.go

raw symbols SCIP
1 package build
2
3 import "testing"
4
5 func TestCartesian(t *testing.T) {
6 res := Empty(2).Cartesian(Grid(1, 2))
7 exp := "4 [{0 1} {2 3}]"
8 if mess, diff := diff(res.String(), exp); diff {
9 t.Errorf("Cartesian %s", mess)
10 }
11 Consistent("Cartesian1", t, res)
12
13 res = Kn(1).Cartesian(Grid(1, 2))
14 exp = "2 [{0 1}]"
15 if mess, diff := diff(res.String(), exp); diff {
16 t.Errorf("Cartesian %s", mess)
17 }
18 Consistent("Cartesian2", t, res)
19
20 res = Grid(1, 2).Cartesian(Grid(1, 2))
21 exp = "4 [{0 1} {0 2} {1 3} {2 3}]"
22 if mess, diff := diff(res.String(), exp); diff {
23 t.Errorf("Cartesian %s", mess)
24 }
25 Consistent("Cartesian3", t, res)
26
27 res = Grid(1, 3).Cartesian(Grid(1, 3))
28 exp = "9 [{0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 7} {5 8} {6 7} {7 8}]"
29 if mess, diff := diff(res.String(), exp); diff {
30 t.Errorf("Cartesian %s", mess)
31 }
32 Consistent("Cartesian4", t, res)
33
34 res = Kn(2).Cartesian(Grid(1, 2))
35 exp = "4 [{0 1} {0 2} {1 3} {2 3}]"
36 if mess, diff := diff(res.String(), exp); diff {
37 t.Errorf("Cartesian %s", mess)
38 }
39 Consistent("Cartesian5", t, res)
40
41 for m := 0; m < 4; m++ {
42 for n := 0; n < 4; n++ {
43 Consistent("Cartesian6", t, Kn(m).Cartesian(Cycle(n)))
44 Consistent("Cartesian7", t, Kn(m).Cartesian(Grid(m, m+n)))
45 Consistent("Cartesian8", t, Grid(m, m+n).Cartesian(Kn(m)))
46 }
47 }
48 }