...
1 package drawing
2
3 import (
4 "testing"
5 )
6
7 var strTree = &StringTree{
8 Data: "gma",
9 Children: []*StringTree{
10 {
11 Data: "dad",
12 Children: []*StringTree{
13 {
14 Data: "me",
15 Children: []*StringTree{
16 {
17 Data: "leif",
18 Children: []*StringTree{
19 {
20 Data: "leif jr",
21 Children: []*StringTree{{Data: "leif jr jr"}},
22 },
23 },
24 },
25 {
26 Data: "toxic",
27 Children: []*StringTree{{Data: "toxic jr"}},
28 },
29 {
30 Data: "tupelo",
31 Children: []*StringTree{{Data: "tupelo jr"}},
32 },
33 },
34 },
35 {
36 Data: "brother",
37 Children: []*StringTree{{Data: "niece"}},
38 },
39 },
40 },
41 {
42 Data: "aunt",
43 Children: []*StringTree{
44 {Data: "cousin_nochild"},
45 {
46 Data: "cousin_withchild",
47 Children: []*StringTree{{Data: "first_cousin-1"}},
48 },
49 },
50 },
51 {
52 Data: "uncle",
53 Children: []*StringTree{
54 {Data: "cousin1"},
55 {Data: "cousin2"},
56 },
57 },
58 },
59 }
60
61 func TestPrintTree(_ *testing.T) {
62 strTree.Print()
63 }
64
65 func dotTree() *DotTree {
66
67 dep1 := &DotNode{Data: "dep1"}
68 dep2 := &DotNode{Data: "dep2"}
69 root := &DotNode{
70 Data: "some pallet digraph",
71 Children: []*DotNode{
72 dep1, dep2,
73 },
74 }
75 nodes := map[string]*DotNode{
76 dep1.Data: dep1,
77 dep2.Data: dep2,
78 root.Data: root,
79 }
80 return &DotTree{
81 Root: root,
82 Nodes: nodes,
83 }
84 }
85
86 func TestPrintDot(_ *testing.T) {
87 dotTree().Print()
88 }
89
View as plain text