-
Notifications
You must be signed in to change notification settings - Fork 23
/
cgminer_test.go
62 lines (56 loc) · 1.37 KB
/
cgminer_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
package cgminer
import (
"fmt"
"testing"
)
// WARNING: These tests are currently terrible, and require a setup such as mine
// (I'm connecting to a real cgminer instance running on a different machine).
// Once I figure out how to mock things out, these tests should improve substantially.
// For now they're more of just a convenient scratch area for manual testing.
func Test_Summary(t *testing.T) {
miner := New("127.0.0.1", 4028)
summary, err := miner.Summary()
if err != nil {
t.Error(err)
return
}
if summary == nil {
t.Error("Summary returned nil")
return
}
// TODO: Make some assertions. Need to mock out the data source first?
}
func Test_Devs(t *testing.T) {
miner := New("127.0.0.1", 4028)
devs, err := miner.Devs()
if err != nil {
t.Error(err)
return
}
if devs == nil {
t.Error("Summary returned nil")
return
}
for _, dev := range *devs {
fmt.Printf("Dev %d temp: %f\n", dev.GPU, dev.Temperature)
}
}
func Test_Pools(t *testing.T) {
miner := New("127.0.0.1", 4028)
pools, err := miner.Pools()
if err != nil {
t.Error(err)
return
}
for _, pool := range pools {
fmt.Printf("Pool %d: %s\n", pool.Pool, pool.URL)
}
}
// func Test_AddPool(t *testing.T) {
// miner := New("192.168.1.9", 4028)
// err := miner.AddPool("stratum+tcp://world.wemineltc.com:3333", "NotReal", "notreal")
// if err != nil {
// t.Error(err)
// return
// }
// }