diff options
author | Shane <shane@skysafe.io> | 2018-05-23 13:47:00 -0700 |
---|---|---|
committer | Andrej Rode <mail@andrejro.de> | 2019-01-26 14:06:12 +0100 |
commit | 38094b268bd2a3c4fb3474557234c6cc1780fbab (patch) | |
tree | d3e8bc47ff997bc6d8b8b8cdc4f0ac10d3c95c5d /gnuradio-runtime/python/pmt | |
parent | 6535c2d0feaf7ef397e1263acdc870d7b7a55a06 (diff) |
Added a bunch of tests that will only work after fixing the pmt bug
Diffstat (limited to 'gnuradio-runtime/python/pmt')
-rw-r--r-- | gnuradio-runtime/python/pmt/qa_pmt.py | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/gnuradio-runtime/python/pmt/qa_pmt.py b/gnuradio-runtime/python/pmt/qa_pmt.py index b6df648029..28a13a8a06 100644 --- a/gnuradio-runtime/python/pmt/qa_pmt.py +++ b/gnuradio-runtime/python/pmt/qa_pmt.py @@ -27,6 +27,9 @@ import pmt class test_pmt(unittest.TestCase): + MAXINT32 = (2**31)-1 + MININT32 = (-MAXINT32)-1 + def test01(self): a = pmt.intern("a") b = pmt.from_double(123765) @@ -104,5 +107,71 @@ class test_pmt(unittest.TestCase): d = pmt.deserialize_str(s) self.assertTrue(pmt.equal(v, d)) + def test13(self): + const = self.MAXINT32 + x_pmt = pmt.from_long(const) + s = pmt.serialize_str(x_pmt) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(x_pmt, deser)) + self.assertEqual(const, pmt.to_long(deser)) + + def test14(self): + const = self.MAXINT32 - 1 + x_pmt = pmt.from_long(const) + s = pmt.serialize_str(x_pmt) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(x_pmt, deser)) + self.assertEqual(const,pmt.to_long(deser)) + + def test15(self): + const = self.MAXINT32 + 1 + x_pmt = pmt.from_long(const) + s = pmt.serialize_str(x_pmt) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(x_pmt, deser)) + x_long = pmt.to_long(deser) + self.assertEqual(const, x_long) + + def test16(self): + const = self.MININT32 + x_pmt = pmt.from_long(const) + s = pmt.serialize_str(x_pmt) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(x_pmt, deser)) + + def test17(self): + const = self.MININT32 + 1 + x_pmt = pmt.from_long(const) + s = pmt.serialize_str(x_pmt) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(x_pmt, deser)) + x_long = pmt.to_long(deser) + self.assertEqual(const, x_long) + + def test18(self): + const = self.MININT32 - 1 + x_pmt = pmt.from_long(const) + s = pmt.serialize_str(x_pmt) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(x_pmt, deser)) + x_long = pmt.to_long(deser) + self.assertEqual(const, x_long) + + def test19(self): + max_key = pmt.intern("MAX") + _max = pmt.from_long(self.MAXINT32) + min_key = pmt.intern("MIN") + _min = pmt.from_long(self.MININT32) + d = pmt.make_dict() + d = pmt.dict_add(d, max_key, _max) + d = pmt.dict_add(d, min_key, _min) + s = pmt.serialize_str(d) + deser = pmt.deserialize_str(s) + self.assertTrue(pmt.equal(d, deser)) + p_dict = pmt.to_python(deser) + self.assertEqual(self.MAXINT32, p_dict["MAX"]) + self.assertEqual(self.MININT32, p_dict["MIN"]) + + if __name__ == '__main__': unittest.main() |