@@ -123,6 +123,76 @@ def test_RMC():
123123 assert msg .render () == data
124124
125125
126+ def test_RMC_valid ():
127+ '''The RMC mode indicator and navigation status values are optional.
128+ Test that when supplied the whole message must be valid. When not supplied
129+ only test validation against supplied values.
130+
131+ Supplied means that a `,` exists it does NOT mean that a value had to be
132+ supplied in the space provided. See
133+
134+ https://orolia.com/manuals/VSP/Content/NC_and_SS/Com/Topics/APPENDIX/NMEA_RMCmess.htm
135+
136+ for more information about the RMC Message additions.
137+ '''
138+ msgs = [
139+ # Original
140+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,*33' ,
141+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,*24' ,
142+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,*72' ,
143+
144+ # RMC Timing Messages
145+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,S*4C' ,
146+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,N*51' ,
147+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,*1F' ,
148+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,S*5B' ,
149+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,N*46' ,
150+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,*08' ,
151+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,S*0D' ,
152+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,N*10' ,
153+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,*5E' ,
154+
155+ # RMC Nav Messags
156+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,S,S*33' ,
157+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,S,V*36' ,
158+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,S,*60' ,
159+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,N,A*3C' ,
160+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,N,V*2B' ,
161+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,N,*7D' ,
162+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,,A*72' ,
163+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,,V*65' ,
164+ '$GPRMC,123519.00,A,4807.038,N,01131.000,E,,,230394,,,,*33' ,
165+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,S,A*36' ,
166+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,S,V*21' ,
167+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,S,*77' ,
168+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,N,A*2B' ,
169+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,N,V*3C' ,
170+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,N,*6A' ,
171+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,,A*65' ,
172+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,,V*72' ,
173+ '$GPRMC,123519.00,V,4807.038,N,01131.000,E,,,230394,,,,*24' ,
174+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,S,A*60' ,
175+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,S,V*77' ,
176+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,S,*21' ,
177+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,N,A*7D' ,
178+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,N,V*6A' ,
179+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,N,*3C' ,
180+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,,A*33' ,
181+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,,V*24' ,
182+ '$GPRMC,123519.00,,4807.038,N,01131.000,E,,,230394,,,,*72' ,
183+ ]
184+
185+ # only the first of each section is valid
186+ expected = [False ] * 39
187+ expected [0 ] = True
188+ expected [3 ] = True
189+ expected [12 ] = True
190+
191+ for i , msg in enumerate (msgs ):
192+ parsed = pynmea2 .parse (msg )
193+ assert expected [i ] == parsed .is_valid
194+
195+
126196def test_TXT ():
127197 data = '$GNTXT,01,01,02,ROM BASE 2.01 (75331) Oct 29 2013 13:28:17*44'
128198 msg = pynmea2 .parse (data )
0 commit comments