[chirp_devel] [PATCH 3 of 3] Add a test to look for contradictions in radio_features
Dan Smith
Fri Jun 29 18:22:28 PDT 2012
# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1341019320 25200
# Node ID 8a6ee39c727dc84dff1eebe2b4121ff4f17f7926
# Parent ad0be2483a7cb68e85c2ffdd597befcfcfdfca54
Add a test to look for contradictions in radio_features
diff -r ad0be2483a7c -r 8a6ee39c727d tests/run_tests
--- a/tests/run_tests Fri Jun 29 18:22:00 2012 -0700
+++ b/tests/run_tests Fri Jun 29 18:22:00 2012 -0700
@@ -180,9 +180,9 @@
):
continue
elif k == "dtcs" and ((a.tmode != "DTCS") or
- (a.tmode == "Cross" and tx_mode != "DTCS")):
+ (a.tmode != "Cross" or tx_mode != "DTCS")):
continue
- elif k == "rx_dtcs" and (a.tmode == "Cross" and rx_mode != "DTCS"):
+ elif k == "rx_dtcs" and (a.tmode != "Cross" or rx_mode != "DTCS"):
continue
elif k == "offset" and not a.duplex:
continue
@@ -765,6 +765,36 @@
TESTS["Clone"] = TestCaseClone
+class TestFeatures(TestCase):
+ def _check_cross_modes(self):
+ rf = self._wrapper.do("get_features")
+
+ if "Cross" in rf.valid_tmodes and not rf.valid_cross_modes:
+ raise TestFailedError("Radio claims Cross tone mode support, "
+ "but declares none")
+ if "Cross" not in rf.valid_tmodes and rf.valid_cross_modes:
+ raise TestFailedError("Radio claims no Cross tone mode support, "
+ "yet declares some")
+
+ def _check_rx_dtcs(self):
+ rf = self._wrapper.do("get_features")
+
+ for cross_mode in rf.valid_cross_modes:
+ if "->DTCS" in cross_mode and not rf.has_rx_dtcs:
+ raise TestFailedError("Radio has receive DTCS cross mode, "
+ "yet not has_rx_dtcs")
+
+ def run(self):
+ self._check_cross_modes()
+ self._check_rx_dtcs()
+
+ return []
+
+ def __str__(self):
+ return "Features"
+
+TESTS["Features"] = TestFeatures
+
class TestOutput:
def __init__(self, output=None):
if not output:
More information about the chirp_devel
mailing list