def test_parses_map_3(self): p = GPRMB() p.parse( "$GPRMB,A,x.x,a,c--c,d--d,llll.ll,e,yyyyy.yy,f,g.g,h.h,i.i,j*kk") self.assertEquals("GPRMB", p.sen_type) self.assertEquals("A", p.validity) self.assertEquals("x.x", p.cross_track_error) self.assertEquals("a", p.cte_correction_dir) self.assertEquals("c--c", p.origin_waypoint_id) self.assertEquals("d--d", p.dest_waypoint_id) self.assertEquals("llll.ll", p.dest_lat) self.assertEquals("e", p.dest_lat_dir) self.assertEquals("yyyyy.yy", p.dest_lon) self.assertEquals("f", p.dest_lon_dir) self.assertEquals("g.g", p.dest_range) self.assertEquals("h.h", p.dest_true_bearing) self.assertEquals("i.i", p.dest_velocity) # This should include the bogus checksum as the checksum is not a valid # hex pair and should not be stripped off self.assertEquals("j*kk", p.arrival_alarm) # There should be no checksum as it was not a valid hex pair self.assertFalse(hasattr(p, 'checksum'))
def test_parses_map_2(self): p = GPRMB() p.parse("$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D") self.assertEqual("GPRMB", p.sen_type) self.assertEqual("A", p.validity) self.assertEqual("4.08", p.cross_track_error) self.assertEqual("L", p.cte_correction_dir) self.assertEqual("EGLL", p.origin_waypoint_id) self.assertEqual("EGLM", p.dest_waypoint_id) self.assertEqual("5130.02", p.dest_lat) self.assertEqual("N", p.dest_lat_dir) self.assertEqual("00046.34", p.dest_lon) self.assertEqual("W", p.dest_lon_dir) self.assertEqual("004.6", p.dest_range) self.assertEqual("213.9", p.dest_true_bearing) self.assertEqual("122.9", p.dest_velocity) self.assertEqual("A", p.arrival_alarm) self.assertEqual("3D", p.checksum)
def test_parses_map_1(self): p = GPRMB() p.parse("$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20") self.assertEqual("GPRMB", p.sen_type) self.assertEqual("A", p.validity) self.assertEqual("0.66", p.cross_track_error) self.assertEqual("L", p.cte_correction_dir) self.assertEqual("003", p.origin_waypoint_id) self.assertEqual("004", p.dest_waypoint_id) self.assertEqual("4917.24", p.dest_lat) self.assertEqual("N", p.dest_lat_dir) self.assertEqual("12309.57", p.dest_lon) self.assertEqual("W", p.dest_lon_dir) self.assertEqual("001.3", p.dest_range) self.assertEqual("052.5", p.dest_true_bearing) self.assertEqual("000.5", p.dest_velocity) self.assertEqual("V", p.arrival_alarm) self.assertEqual("20", p.checksum)
def test_parses_map_2(self): p = GPRMB() p.parse( "$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D" ) self.assertEquals("GPRMB", p.sen_type) self.assertEquals("A", p.validity) self.assertEquals("4.08", p.cross_track_error) self.assertEquals("L", p.cte_correction_dir) self.assertEquals("EGLL", p.origin_waypoint_id) self.assertEquals("EGLM", p.dest_waypoint_id) self.assertEquals("5130.02", p.dest_lat) self.assertEquals("N", p.dest_lat_dir) self.assertEquals("00046.34", p.dest_lon) self.assertEquals("W", p.dest_lon_dir) self.assertEquals("004.6", p.dest_range) self.assertEquals("213.9", p.dest_true_bearing) self.assertEquals("122.9", p.dest_velocity) self.assertEquals("A", p.arrival_alarm) self.assertEquals("3D", p.checksum)
def test_parses_map_1(self): p = GPRMB() p.parse( "$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20" ) self.assertEquals("GPRMB", p.sen_type) self.assertEquals("A", p.validity) self.assertEquals("0.66", p.cross_track_error) self.assertEquals("L", p.cte_correction_dir) self.assertEquals("003", p.origin_waypoint_id) self.assertEquals("004", p.dest_waypoint_id) self.assertEquals("4917.24", p.dest_lat) self.assertEquals("N", p.dest_lat_dir) self.assertEquals("12309.57", p.dest_lon) self.assertEquals("W", p.dest_lon_dir) self.assertEquals("001.3", p.dest_range) self.assertEquals("052.5", p.dest_true_bearing) self.assertEquals("000.5", p.dest_velocity) self.assertEquals("V", p.arrival_alarm) self.assertEquals("20", p.checksum)
def test_parses_map_3(self): p = GPRMB() p.parse("$GPRMB,A,x.x,a,c--c,d--d,llll.ll,e,yyyyy.yy,f,g.g,h.h,i.i,j*kk") self.assertEqual("GPRMB", p.sen_type) self.assertEqual("A", p.validity) self.assertEqual("x.x", p.cross_track_error) self.assertEqual("a", p.cte_correction_dir) self.assertEqual("c--c", p.origin_waypoint_id) self.assertEqual("d--d", p.dest_waypoint_id) self.assertEqual("llll.ll", p.dest_lat) self.assertEqual("e", p.dest_lat_dir) self.assertEqual("yyyyy.yy", p.dest_lon) self.assertEqual("f", p.dest_lon_dir) self.assertEqual("g.g", p.dest_range) self.assertEqual("h.h", p.dest_true_bearing) self.assertEqual("i.i", p.dest_velocity) # This should include the bogus checksum as the checksum is not a valid # hex pair and should not be stripped off self.assertEqual("j*kk", p.arrival_alarm) # There should be no checksum as it was not a valid hex pair self.assertFalse(hasattr(p, 'checksum'))
def test_checksum_fails(self): p = GPRMB() p.checksum = '21' p.nmea_sentence = '$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*21' result = p.check_chksum() self.assertFalse(result)