Exemple #1
0
 def test_drop_old(self):
     self.i.receive(parse_tnc2('FOO>RX:>', _dummy_receive_time))
     self.assertEqual(['FOO'], self.i.state().keys())
     self.i.receive(parse_tnc2('BAR>RX:>', _dummy_receive_time + 1799.9))
     self.assertEqual({'BAR', 'FOO'}, set(self.i.state().keys()))
     self.i.receive(parse_tnc2('BAR>RX:>', _dummy_receive_time + 1800))
     self.assertEqual(['BAR'], self.i.state().keys())
Exemple #2
0
 def test_object_kill(self):
     self.__receive(parse_tnc2(
         'KE6AFE-2>APU25N,WR6ABD*,NCA1:;TFCSCRUZ *160323z3655.94N\12200.92W?70 In 10 Minutes',
         _dummy_receive_time))
     self.assertEqual({'KE6AFE-2', 'TFCSCRUZ '}, set(self.store.state().keys()))
     self.__receive(parse_tnc2(
         'FOO>BAR:;TFCSCRUZ _160323z3655.94N\12200.92W?',
         _dummy_receive_time))
     self.assertEqual({'FOO', 'KE6AFE-2'}, set(self.store.state().keys()))
Exemple #3
0
 def test_drop_old(self):
     self.__receive(parse_tnc2('FOO>RX:>', _dummy_receive_time))
     self.assertEqual(['FOO'], self.store.state().keys())
     self.clock.advance(1799.5)
     self.__receive(parse_tnc2('BAR>RX:>', _dummy_receive_time + 1799.5))
     self.assertEqual({'BAR', 'FOO'}, set(self.store.state().keys()))
     self.clock.advance(0.5)
     self.__receive(parse_tnc2('BAR>RX:>', _dummy_receive_time + 1800))
     self.assertEqual(['BAR'], self.store.state().keys())
Exemple #4
0
 def test_drop_old(self):
     self.__receive(parse_tnc2('FOO>RX:>', _dummy_receive_time))
     self.assertEqual(['FOO'], self.store.state().keys())
     self.clock.advance(1799.5)
     self.__receive(parse_tnc2('BAR>RX:>', _dummy_receive_time + 1799.5))
     self.assertEqual({'BAR', 'FOO'}, set(self.store.state().keys()))
     self.clock.advance(0.5)
     self.__receive(parse_tnc2('BAR>RX:>', _dummy_receive_time + 1800))
     self.assertEqual(['BAR'], self.store.state().keys())
Exemple #5
0
 def test_object_kill(self):
     self.__receive(parse_tnc2(
         'KE6AFE-2>APU25N,WR6ABD*,NCA1:;TFCSCRUZ *160323z3655.94N\12200.92W?70 In 10 Minutes',
         _dummy_receive_time))
     self.assertEqual({'KE6AFE-2', 'TFCSCRUZ '}, set(self.store.state().keys()))
     self.__receive(parse_tnc2(
         'FOO>BAR:;TFCSCRUZ _160323z3655.94N\12200.92W?',
         _dummy_receive_time))
     self.assertEqual({'FOO', 'KE6AFE-2'}, set(self.store.state().keys()))
Exemple #6
0
 def test_new_station(self):
     self.assertEqual([], self.store.state().keys())
     self.__receive(
         parse_tnc2(
             'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
             _dummy_receive_time))
     self.assertEqual(['N6WKZ-3'], self.store.state().keys())
Exemple #7
0
 def receive(line):
     # %r here provides robustness against arbitrary bytes.
     log.msg(u'APRS: %r' % (line,))
     message = parse_tnc2(line, time.time())
     log.msg(u'   -> %s' % (message,))
     self.__information.receive(message)
Exemple #8
0
 def receive(line):
     message = parse_tnc2(line, time.time(), log=self.__log)
     context.output_message(message)
Exemple #9
0
# (at your option) any later version.
#
# ShinySDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ShinySDR.  If not, see <http://www.gnu.org/licenses/>.
"""
Test for APRS parser. Accepts lines and prints the parsed form.
"""

from __future__ import absolute_import, division

import string
import sys
import time

from shinysdr.plugins import aprs

if __name__ == '__main__':
    for line in sys.stdin:
        print string.rstrip(line, '\n')
        parsed = aprs.parse_tnc2(line, time.time())
        for error in parsed.errors:
            print '--!--', error
        for fact in parsed.facts:
            print '     ', fact
        print
Exemple #10
0
 def test_object_item_report(self):
     self.i.receive(
         parse_tnc2(
             'KE6AFE-2>APU25N,WR6ABD*,NCA1:;TFCSCRUZ *160323z3655.94N\12200.92W?70 In 10 Minutes',
             _dummy_receive_time))
     self.assertEqual(['KE6AFE-2', 'TFCSCRUZ '], self.i.state().keys())
Exemple #11
0
# ShinySDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ShinySDR.  If not, see <http://www.gnu.org/licenses/>.

"""
Test for APRS parser. Accepts lines and prints the parsed form.
"""

from __future__ import absolute_import, division

import string
import sys
import time

from shinysdr.plugins import aprs


if __name__ == "__main__":
    for line in sys.stdin:
        print string.rstrip(line, "\n")
        parsed = aprs.parse_tnc2(line, time.time())
        for error in parsed.errors:
            print "--!--", error
        for fact in parsed.facts:
            print "     ", fact
        print
Exemple #12
0
	def test_new_station(self):
		self.assertEqual([], self.i.state().keys())
		self.i.receive(parse_tnc2(
			'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
			_dummy_receive_time))
		self.assertEqual(['N6WKZ-3'], self.i.state().keys())
Exemple #13
0
 def receive(line):
     # %r here provides robustness against arbitrary bytes.
     log.msg(u'APRS: %r' % (line,))
     message = parse_tnc2(line, time.time())
     log.msg(u'   -> %s' % (message,))
     context.output_message(message)
Exemple #14
0
 def test_object_item_report(self):
     self.i.receive(parse_tnc2(
         'KE6AFE-2>APU25N,WR6ABD*,NCA1:;TFCSCRUZ *160323z3655.94N\12200.92W?70 In 10 Minutes',
         _dummy_receive_time))
     self.assertEqual(['KE6AFE-2', 'TFCSCRUZ '], self.i.state().keys())
Exemple #15
0
		def receive(line):
			log.msg(u'APRS: %s' % (line,))
			message = parse_tnc2(line, time.time())
			log.msg(u'   -> %s' % (message,))
			self.__information.receive(message)
Exemple #16
0
	def __check(self, line, parsed):
		self.assertEqual(parse_tnc2(line, _dummy_receive_time), parsed)
Exemple #17
0
 def __check(self, line, parsed):
     self.assertEqual(parse_tnc2(line, _dummy_receive_time), parsed)
Exemple #18
0
	def __check_parsed(self, line, facts, errors, comment=''):
		parsed = parse_tnc2(line, _dummy_receive_time)
		# Check errors first so if we fail to parse we report the errors and not only missing facts
		self.assertEqual(parsed.errors, errors)
		self.assertEqual(parsed.facts, facts)
		self.assertEqual(parsed.comment, comment)
Exemple #19
0
 def __check_parsed(self, line, facts, errors, comment=''):
     parsed = parse_tnc2(line, _dummy_receive_time)
     # Check errors first so if we fail to parse we report the errors and not only missing facts
     self.assertEqual(parsed.errors, errors)
     self.assertEqual(parsed.facts, facts)
     self.assertEqual(parsed.comment, comment)
Exemple #20
0
 def receive(line):
     log.msg(u'APRS: %s' % (line, ))
     message = parse_tnc2(line, time.time())
     log.msg(u'   -> %s' % (message, ))
     self.__information.receive(message)
Exemple #21
0
 def receive(line):
     # %r here provides robustness against arbitrary bytes.
     log.msg(u'APRS: %r' % (line, ))
     message = parse_tnc2(line, time.time())
     log.msg(u'   -> %s' % (message, ))
     context.output_message(message)
Exemple #22
0
 def receive(line):
     # %r here provides robustness against arbitrary bytes.
     log.msg(u'APRS: %r' % (line, ))
     message = parse_tnc2(line, time.time())
     log.msg(u'   -> %s' % (message, ))
     self.__information.receive(message)