Introduce unit test for bertlv_parse_one()

Change-Id: I3adbe22afd4b6503a7454de39b7663e9ede8995f
This commit is contained in:
Harald Welte 2021-05-21 21:48:11 +02:00
parent c1475307c8
commit e7506036bd
1 changed files with 4 additions and 0 deletions

View File

@ -175,6 +175,10 @@ class TestBerTlv(unittest.TestCase):
self.assertEqual(utils.bertlv_parse_len(b'\x81\x80'), (128, b''))
self.assertEqual(utils.bertlv_parse_len(b'\x83\x12\x34\x56\x78'), (0x123456, b'\x78'))
def test_BerTlvParseOne(self):
res = utils.bertlv_parse_one(b'\x81\x01\x01');
self.assertEqual(res, ({'tag':1, 'constructed':False, 'class':2}, 1, b'\x01', b''))
if __name__ == "__main__":
unittest.main()