From aaa6a96a47108d1f818ff5837808c242d83d7451 Mon Sep 17 00:00:00 2001 From: JHCD Date: Fri, 3 Jul 2015 23:16:11 +0200 Subject: [PATCH] add testdata driver for testing all the different stuff see issue #38 add much more testdate --- boswatch.py | 33 ++++++------- testdata/testdata.txt | 109 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 105 insertions(+), 37 deletions(-) diff --git a/boswatch.py b/boswatch.py index b0b423a..be531a6 100755 --- a/boswatch.py +++ b/boswatch.py @@ -330,29 +330,26 @@ try: logging.debug("cannot start multimon-ng", exc_info=True) exit(1) - # multimon-ng started, continue... - logging.debug("start decoding") - # # Get decoded data from multimon-ng and call BOSWatch-decoder # - while True: - if not args.test: + if not args.test: + logging.debug("start decoding") + while True: decoded = str(multimon_ng.stdout.readline()) #Get line data from multimon stdout + from includes import decoder + decoder.decode(converter.freqToHz(args.freq), decoded) - else: - # Test-strings only for develop - #decoded = "ZVEI2: 25832" - #decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct\n'" - #decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct\n'" - #decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct\n'" - #decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct\n'" - #decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct\n'" - decoded = "POCSAG1200: Address: 1234567 Function: 1 Alpha: Hello World" - time.sleep(1) - - from includes import decoder - decoder.decode(converter.freqToHz(args.freq), decoded) + else: + logging.debug("start testing") + testFile = open(globals.script_path+"/testdata/testdata.txt","r") + for testData in testFile: + if (len(testData) > 1) and ("#" not in testData[0]): + logging.info("Testdata: %s", testData.rstrip(' \t\n\r')) + from includes import decoder + decoder.decode(converter.freqToHz(args.freq), testData) + time.sleep(1) + logging.debug("test finished") except KeyboardInterrupt: logging.warning("Keyboard Interrupt") diff --git a/testdata/testdata.txt b/testdata/testdata.txt index b824614..ada9630 100644 --- a/testdata/testdata.txt +++ b/testdata/testdata.txt @@ -1,30 +1,101 @@ -#Testdata for the BOSWatch Test Mode function -#Data in Multimon-NG Raw Format -#Data is alternately passed to the decoder to simulate an used Radio-Frequency +# Testdata for the BOSWatch Test Mode function +# Data in Multimon-NG Raw Format +# Data is alternately passed to the decoder to simulate an used Radio-Frequency -#POCSAG -#all bitrates, all functions, with and without text, duplicates same and other msg +# +# POCSAG +# ------ +# -#witch csv -POCSAG512: Address: 1234567 Function: 1 Alpha: Hello World +# +# The following settings in config.ini are expected for pocsag +# +# [BOSWatch] +# useDescription = 1 +# doubleFilter_ignore_entries = 10 +# doubleFilter_check_msg = 1 +# +# [POC] +# deny_ric = 7777777 +# filter_range_start = 1000000 +# filter_range_end = 8999999 +# idDescribed = 1 +# -#without csv -POCSAG1200: Address: 2345678 Function: 2 Alpha: Hello World -POCSAG2400: Address: 3456789 Function: 3 Alpha: Hello World +# bitrate +POCSAG512: Address: 1000512 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG1200: Address: 1001200 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG2400: Address: 1002400 Function: 1 Alpha: BOSWatch-Test: okay -#OHNE TEXT???? -POCSAG1200: Address: 1358246 Function: 4 +# function-code +POCSAG512: Address: 1000000 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000001 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000002 Function: 2 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000003 Function: 3 Alpha: BOSWatch-Test: okay -#duplicate with same and other msg -POCSAG1200: Address: 2345678 Function: 2 Alpha: Hello World -POCSAG1200: Address: 2345678 Function: 2 Alpha: Bye Earth +# witch csv +POCSAG512: Address: 1234567 Function: 1 Alpha: BOSWatch-Test: with csv -#invalid -POCSAG1200: Address: 123567 Function: 1 Alpha: Hello World +# without csv +POCSAG1200: Address: 2345678 Function: 2 Alpha: BOSWatch-Test: without csv +POCSAG2400: Address: 3456789 Function: 3 Alpha: BOSWatch-Test: without csv -#FMS +# OHNE TEXT???? +POCSAG1200: Address: 1100000 Function: 1 +POCSAG1200: Address: 1100000 Function: 2 +POCSAG1200: Address: 1100000 Function: 3 +POCSAG1200: Address: 1100000 Function: 4 + +# duplicate with same and other msg +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Testing: okay + +# duplicate in different order +POCSAG1200: Address: 2100000 Function: 2 Alpha: +POCSAG1200: Address: 2100001 Function: 2 Alpha: +POCSAG1200: Address: 2100002 Function: 2 Alpha: +POCSAG1200: Address: 2100000 Function: 2 Alpha: +POCSAG1200: Address: 2100001 Function: 2 Alpha: +POCSAG1200: Address: 2100002 Function: 2 Alpha: +POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate + +# invalid +POCSAG512: Address: 123456 Function: 0 Alpha: BOSWatch-Test: invalid +POCSAG1200: Address: 123456 Function: 1 Alpha: BOSWatch-Test: invalid +POCSAG2400: Address: 1234567 Function: 4 Alpha: BOSWatch-Test: invalid + +# denied +POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied + +# out of filter Range +POCSAG1200: Address: 0999999 Function: 1 Alpha: BOSWatch-Test: out of filter start +POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end + +# regEx-Filter? + + +# +# FMS +# --- +# +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct + + +# +# ZVEI +# ---- +# -#ZVEI #with csv description ZVEI2: 12345 #without csv description