예제 #1
0
    def test_parses_map_2(self):
        p = GPVTG()
        p.parse("GPVTG,054.7,T,034.4,M,005.5,N,010.2,K")

        self.assertEqual("GPVTG", p.sen_type)
        self.assertEqual("054.7", p.true_track)
        self.assertEqual("T", p.true_track_sym)
        self.assertEqual("034.4", p.mag_track)
        self.assertEqual("M", p.mag_track_sym)
        self.assertEqual("005.5", p.spd_over_grnd_kts)
        self.assertEqual("N", p.spd_over_grnd_kts_sym)
        self.assertEqual("010.2", p.spd_over_grnd_kmph)
        self.assertEqual("K", p.spd_over_grnd_kmph_sym)
        self.assertFalse(hasattr(p, 'checksum'))
예제 #2
0
    def test_parses_map_1(self):
        p = GPVTG()
        p.parse("$GPVTG,360.0,T,348.7,M,000.0,N,000.0,K*43")

        self.assertEqual("GPVTG", p.sen_type)
        self.assertEqual("360.0", p.true_track)
        self.assertEqual("T", p.true_track_sym)
        self.assertEqual("348.7", p.mag_track)
        self.assertEqual("M", p.mag_track_sym)
        self.assertEqual("000.0", p.spd_over_grnd_kts)
        self.assertEqual("N", p.spd_over_grnd_kts_sym)
        self.assertEqual("000.0", p.spd_over_grnd_kmph)
        self.assertEqual("K", p.spd_over_grnd_kmph_sym)
        self.assertEqual('43', p.checksum)
예제 #3
0
    def test_parses_map_2(self):
        p = GPVTG()
        p.parse("GPVTG,054.7,T,034.4,M,005.5,N,010.2,K")

        self.assertEquals("GPVTG", p.sen_type)
        self.assertEquals("054.7", p.true_track)
        self.assertEquals("T", p.true_track_sym)
        self.assertEquals("034.4", p.mag_track)
        self.assertEquals("M", p.mag_track_sym)
        self.assertEquals("005.5", p.spd_over_grnd_kts)
        self.assertEquals("N", p.spd_over_grnd_kts_sym)
        self.assertEquals("010.2", p.spd_over_grnd_kmph)
        self.assertEquals("K", p.spd_over_grnd_kmph_sym)
        self.assertFalse(hasattr(p, 'checksum'))
예제 #4
0
    def test_parses_map_1(self):
        p = GPVTG()
        p.parse("$GPVTG,360.0,T,348.7,M,000.0,N,000.0,K*43")

        self.assertEquals("GPVTG", p.sen_type)
        self.assertEquals("360.0", p.true_track)
        self.assertEquals("T", p.true_track_sym)
        self.assertEquals("348.7", p.mag_track)
        self.assertEquals("M", p.mag_track_sym)
        self.assertEquals("000.0", p.spd_over_grnd_kts)
        self.assertEquals("N", p.spd_over_grnd_kts_sym)
        self.assertEquals("000.0", p.spd_over_grnd_kmph)
        self.assertEquals("K", p.spd_over_grnd_kmph_sym)
        self.assertEquals('43', p.checksum)
예제 #5
0
    def test_parses_map3(self):
        p = GPVTG()
        p.parse("$GPVTG,t,T,,,s.ss,N,s.ss,K*hh")

        self.assertEqual("GPVTG", p.sen_type)
        self.assertEqual("t", p.true_track)
        self.assertEqual("T", p.true_track_sym)
        self.assertEqual("", p.mag_track)
        self.assertEqual("", p.mag_track_sym)
        self.assertEqual("s.ss", p.spd_over_grnd_kts)
        self.assertEqual("N", p.spd_over_grnd_kts_sym)
        self.assertEqual("s.ss", p.spd_over_grnd_kmph)

        # The checksum did not get stripped off as it is invalid
        # (not a hex pair).
        self.assertEqual("K*hh", p.spd_over_grnd_kmph_sym)

        # Despite a checksum being listed in the sentence, there should NOT be
        # on on the object as 'hh' is not a valid hex pair
        self.assertFalse(hasattr(p, 'checksum'))
예제 #6
0
    def test_parses_map3(self):
        p = GPVTG()
        p.parse("$GPVTG,t,T,,,s.ss,N,s.ss,K*hh")

        self.assertEquals("GPVTG", p.sen_type)
        self.assertEquals("t", p.true_track)
        self.assertEquals("T", p.true_track_sym)
        self.assertEquals("", p.mag_track)
        self.assertEquals("", p.mag_track_sym)
        self.assertEquals("s.ss", p.spd_over_grnd_kts)
        self.assertEquals("N", p.spd_over_grnd_kts_sym)
        self.assertEquals("s.ss", p.spd_over_grnd_kmph)

        # The checksum did not get stripped off as it is invalid
        # (not a hex pair).
        self.assertEquals("K*hh", p.spd_over_grnd_kmph_sym)

        # Despite a checksum being listed in the sentence, there should NOT be
        # on on the object as 'hh' is not a valid hex pair
        self.assertFalse(hasattr(p, 'checksum'))