-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdvbwebservice_test.go
68 lines (55 loc) · 1.58 KB
/
dvbwebservice_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
package main
import (
"testing"
)
// Run with `go test dvbwebservice_test.go dvbwebservice.go utils.go -bench=.`
func TestCreateBodyForConnection(t *testing.T) {
body := createBodyForConnection("de:14612:17", "de:14612:27", 1)
if body == "" {
t.Error("TestCreateBodyForConnection is null")
}
}
func BenchmarkCreateBodyForConnection(b *testing.B) {
for i := 0; i < b.N; i++ {
createBodyForConnection("de:14612:17", "de:14612:27", 1)
}
}
func TestCallDvbApi(t *testing.T) {
body := createBodyForConnection("de:14612:17", "de:14612:27", 1)
result := callDvbApi(body)
if result == "" {
t.Error("TestCallDvbApi is null")
}
}
func BenchmarkCallDvbApi(b *testing.B) {
body := createBodyForConnection("de:14612:17", "de:14612:27", 1)
for i := 0; i < b.N; i++ {
callDvbApi(body)
}
}
func TestGetConnectionsFromDvb(t *testing.T) {
cons := GetConnectionsFromDvb("de:14612:17", "de:14612:27", 1)
if len(cons) != 1 {
t.Error("TestGetConnectionsFromDvb has not 1 Connection")
}
}
func BenchmarkGetConnectionsFromDvb(b *testing.B) {
for i := 0; i < b.N; i++ {
GetConnectionsFromDvb("de:14612:17", "de:14612:27", 1)
}
}
func TestProcessRouteResults(t *testing.T) {
body := createBodyForConnection("de:14612:17", "de:14612:27", 1)
result := callDvbApi(body)
cons := processRouteResults(result)
if len(cons) != 1 {
t.Error("TestProcessRouteResults has not 1 Connection")
}
}
func BenchmarkProcessRouteResults(b *testing.B) {
body := createBodyForConnection("de:14612:17", "de:14612:27", 1)
result := callDvbApi(body)
for i := 0; i < b.N; i++ {
processRouteResults(result)
}
}