-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_test.go
100 lines (92 loc) · 2.19 KB
/
app_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
import (
"testing"
"github.com/jagandecapri/vision/server"
"os"
"os/signal"
)
func TestBootServer(t *testing.T) {
// Set up channel on which to send signal notifications.
// We must use a buffered channel or risk missing the signal
// if we're not ready to receive when the signal is sent.
test_data := server.HttpData{
server.Graph{
Graph_metadata: server.Graph_metadata{ID: "first-second",
Column_x: "first",
Column_y: "second"},
PointsContainer: []server.PointsContainer{{
Point_list: []server.Point{{
Point_data: server.Point_data{X: 0.05, Y: 0.05},
}},
Points_metadata: server.Points_metadata{Color: "#FF0000"},
},
{
Point_list: []server.Point{{
Point_data: server.Point_data{X: 0.15, Y: 0.15},
}},
Points_metadata: server.Points_metadata{Color: "#800000"},
},
{
Point_list: []server.Point{{
Point_data: server.Point_data{X: 0.25, Y: 0.25},
}},
Points_metadata: server.Points_metadata{Color: "#FFFF00"},
},
},
},
server.Graph{
Graph_metadata: server.Graph_metadata{ID: "third-fourth",
Column_x: "third",
Column_y: "fourth"},
PointsContainer: []server.PointsContainer{{
Point_list: []server.Point{{
Point_data: server.Point_data{X: 0.05, Y: 0.05},
}},
Points_metadata: server.Points_metadata{Color: "#FF0000"},
},
{
Point_list: []server.Point{{
Point_data: server.Point_data{X: 0.15, Y: 0.15},
}},
Points_metadata: server.Points_metadata{Color: "#800000"},
},
{
Point_list: []server.Point{{
Point_data: server.Point_data{X: 0.25, Y: 0.25},
}},
Points_metadata: server.Points_metadata{Color: "#FFFF00"},
},
},
},
}
data := make(chan server.HttpData)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
BootServer(data)
//ticker := time.NewTicker(10 * time.Second)
//
//go func() {
// for t := range ticker.C{
// fmt.Println("Tick at", t)
// data <- test_data
// }
//}()
//
//for {
// // Block until a signal is received.
// select {
// case <- c:
// ticker.Stop()
// break;
// default:
// }
//}
for {
data <- test_data
select {
case <-c:
break;
default:
}
}
}