소스 검색

Added a test for the latitude/longitude parsing.

Michael Hope 3 년 전
부모
커밋
a82439ad61
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      src/juju.net.nz/gps/parser_test.go

+ 9 - 0
src/juju.net.nz/gps/parser_test.go 파일 보기

@@ -2,6 +2,7 @@ package gps
2 2
 
3 3
 import (
4 4
 	"testing"
5
+	testex "juju.net.nz/testex"
5 6
 )
6 7
 
7 8
 func TestStrings(t *testing.T) {
@@ -38,3 +39,11 @@ func TestTime(t *testing.T) {
38 39
 	if p.GetTime(0) != expect { t.Error(); }
39 40
 	if p.Err != nil { t.Error(); }
40 41
 }
42
+
43
+func TestLatLong(t *testing.T) {
44
+	p := &Parser{fields: []string{"4124.8963", "N"}}
45
+
46
+	expect := 41 + 24.8963/60
47
+	if !testex.Close(t, p.GetLatLong(0), expect) { t.Error(); }
48
+	if p.Err != nil { t.Error(); }
49
+}