File: must_test.go

package info (click to toggle)
golang-github-adrianmo-go-nmea 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 900 kB
  • sloc: makefile: 15
file content (48 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (2)
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
}