forked from jdgordon/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
must_test.go
48 lines (43 loc) · 927 Bytes
/
must_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
package nmea
// MustParseLatLong parses the supplied string into the LatLong.
// It panics if an error is encountered
func MustParseLatLong(s string) float64 {
l, err := ParseLatLong(s)
if err != nil {
panic(err)
}
return l
}
// MustParseGPS parses a GPS/NMEA coordinate or panics if it fails.
func MustParseGPS(s string) float64 {
l, err := ParseGPS(s)
if err != nil {
panic(err)
}
return l
}
// MustParseDMS parses a coordinate in degrees, minutes, seconds and
// panics on failure
func MustParseDMS(s string) float64 {
l, err := ParseDMS(s)
if err != nil {
panic(err)
}
return l
}
// MustParseTime parses wall clock and panics on failure
func MustParseTime(s string) Time {
t, err := ParseTime(s)
if err != nil {
panic(err)
}
return t
}
// MustParseDate parses a date and panics on failure
func MustParseDate(s string) Date {
d, err := ParseDate(s)
if err != nil {
panic(err)
}
return d
}