forked from ricallinson/tpms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensor_test.go
More file actions
45 lines (35 loc) · 709 Bytes
/
sensor_test.go
File metadata and controls
45 lines (35 loc) · 709 Bytes
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
package tpms
import (
"fmt"
. "github.com/ricallinson/simplebdd"
"log"
"os"
"reflect"
"testing"
)
func TestSensor(t *testing.T) {
var sensor *Sensor
BeforeEach(func() {
sensor = &Sensor{}
})
AfterEach(func() {
})
Describe("Tpms()", func() {
It("should return a Sensor object", func() {
AssertEqual(reflect.TypeOf(sensor).String(), "*tpms.Sensor")
})
It("should ", func() {
file, err := os.Open("./fixtures/cold")
if err != nil {
log.Fatal(err)
}
data := make([]byte, 1872)
file.Read(data)
for i := 0; i < 1872; i = i + 18 {
sensor.ParseData(data[i:])
fmt.Printf("kPa: %v, °C: %v\n", sensor.Kilopascal, sensor.Celsius)
}
})
})
Report(t)
}