# Path: ogn/parser/utils.py
# FPM_TO_MS = FEETS_TO_METER / 60     # ratio fpm to m/s
# 
# Path: ogn/parser/aprs_comment/safesky_parser.py
# class SafeskyParser(BaseParser):
#     def __init__(self):
#         self.beacon_type = 'safesky'
#         self.position_pattern = PATTERN_SAFESKY_POSITION_COMMENT
# 
#     def parse_position(self, aprs_comment):
#         match = self.position_pattern.match(aprs_comment)
#         result = dict()
#         if match.group('details'):
#             result.update({
#                 'address_type': int(match.group('details'), 16) & 0b00000011,
#                 'aircraft_type': (int(match.group('details'), 16) & 0b00111100) >> 2,
#                 'no-tracking': (int(match.group('details'), 16) & 0b01000000) >> 6 == 1,
#                 'stealth': (int(match.group('details'), 16) & 0b10000000) >> 7 == 1,
#                 'address': match.group('address'),
#             })
#         result.update(
#             {'climb_rate': int(match.group('climb_rate')) * FPM_TO_MS if match.group('climb_rate') else None})
#         if match.group('gps_quality'):
#             result.update({
#                 'gps_quality': {
#                     'horizontal': int(match.group('gps_quality_horizontal')),
#                     'vertical': int(match.group('gps_quality_vertical'))
#                 }
#             })
#         return result


import unittest
from ogn.parser.utils import FPM_TO_MS
from ogn.parser.aprs_comment.safesky_parser import SafeskyParser



class TestStringMethods(unittest.TestCase):
    def test_position_comment(self):
        # "SKY3E5906>OGNSKY,qAS,SafeSky:/072555h5103.47N/00524.81E'065/031/A=001250 !W05! id1C3E5906 +010fpm gps6x1"
        message = SafeskyParser().parse_position("id1C3E5906 +010fpm gps6x1")
        self.assertEqual(message['address'], '3E5906')
        self.assertEqual(message['address_type'], 0)

# Path: ogn/parser/utils.py
# FPM_TO_MS = FEETS_TO_METER / 60     # ratio fpm to m/s
# 
# Path: ogn/parser/aprs_comment/safesky_parser.py
# class SafeskyParser(BaseParser):
#     def __init__(self):
#         self.beacon_type = 'safesky'
#         self.position_pattern = PATTERN_SAFESKY_POSITION_COMMENT
# 
#     def parse_position(self, aprs_comment):
#         match = self.position_pattern.match(aprs_comment)
#         result = dict()
#         if match.group('details'):
#             result.update({
#                 'address_type': int(match.group('details'), 16) & 0b00000011,
#                 'aircraft_type': (int(match.group('details'), 16) & 0b00111100) >> 2,
#                 'no-tracking': (int(match.group('details'), 16) & 0b01000000) >> 6 == 1,
#                 'stealth': (int(match.group('details'), 16) & 0b10000000) >> 7 == 1,
#                 'address': match.group('address'),
#             })
#         result.update(
#             {'climb_rate': int(match.group('climb_rate')) * FPM_TO_MS if match.group('climb_rate') else None})
#         if match.group('gps_quality'):
#             result.update({
#                 'gps_quality': {
#                     'horizontal': int(match.group('gps_quality_horizontal')),
#                     'vertical': int(match.group('gps_quality_vertical'))
#                 }
#             })
#         return result


# Path: tests/parser/test_parse_safesky.py
import unittest
from ogn.parser.utils import FPM_TO_MS
from ogn.parser.aprs_comment.safesky_parser import SafeskyParser




class TestStringMethods(unittest.TestCase):
    def test_position_comment(self):
        # "SKY3E5906>OGNSKY,qAS,SafeSky:/072555h5103.47N/00524.81E'065/031/A=001250 !W05! id1C3E5906 +010fpm gps6x1"
        message = SafeskyParser().parse_position("id1C3E5906 +010fpm gps6x1")
        self.assertEqual(message['address'], '3E5906')
        self.assertEqual(message['address_type'], 0)

        self.assertEqual(message['aircraft_type'], 7)