-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswitch_test.go
65 lines (58 loc) · 1.17 KB
/
switch_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
package gogadgets_test
import (
"math/rand"
"time"
"github.com/cswank/gogadgets"
. "github.com/onsi/ginkgo"
// . "github.com/onsi/gomega"
)
func init() {
rand.Seed(time.Now().Unix())
}
var _ = Describe("Switch", func() {
var (
out chan gogadgets.Message
in chan gogadgets.Value
s *gogadgets.Switch
)
BeforeEach(func() {
poller := &FakePoller{}
s = &gogadgets.Switch{
GPIO: poller,
}
out = make(chan gogadgets.Message)
in = make(chan gogadgets.Value)
go s.Start(out, in)
})
Describe("when all's good", func() {
It("does it's thing", func() {
})
})
})
// func TestBoolSwitch(t *testing.T) {
// poller := &FakePoller{}
// s := &Switch{
// GPIO: poller,
// Value: true,
// TrueValue: true,
// }
// out := make(chan Message)
// in := make(chan Value)
// go s.Start(out, in)
// val := <-in
// if val.Value != true {
// t.Error("should have been true", val)
// }
// val = <-in
// if val.Value != false {
// t.Error("should have been false", val)
// }
// out <- Message{
// Type: "command",
// Body: "shutdown",
// }
// v := s.GetValue()
// if v.Value != false {
// t.Error("should have been false", v)
// }
// }