-
Notifications
You must be signed in to change notification settings - Fork 0
/
assertions_test.go
56 lines (50 loc) · 1.08 KB
/
assertions_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
package pmset
import (
"encoding/json"
"testing"
)
func TestSystemAssertions(t *testing.T) {
a := GetAssertions()
b, _ := json.MarshalIndent(a, "", " ")
_, ok := a["PreventUserIdleDisplaySleep"]
if !ok {
t.Errorf("%s\n", b)
}
}
func TestPIDAssertions(t *testing.T) {
a := GetPIDAssertions()
b, _ := json.MarshalIndent(a, "", " ")
_, ok := a["PreventUserIdleDisplaySleep"]
if !ok {
t.Errorf("%s\n", b)
}
}
func TestAssertionChanges(t *testing.T) {
channel := make(chan AssertionChange)
go func() {
for change := range channel {
b, _ := json.MarshalIndent(change, "", " ")
t.Errorf("%s\n", b)
}
}()
SubscribeAssertionChangesAndRun(channel)
}
func TestThermal(t *testing.T) {
a := GetThermalConditions()
b, _ := json.MarshalIndent(a, "", " ")
_, ok := a["CPU_Speed_Limit"]
if !ok {
t.Errorf("%s\n", b)
}
}
func TestThermalSubscription(t *testing.T) {
channel := make(chan bool)
go func() {
for range channel {
a := GetThermalConditions()
b, _ := json.MarshalIndent(a, "", " ")
t.Errorf("%s\n", b)
}
}()
SubscribeThermalChangesAndRun(channel)
}