add pim tests

This commit is contained in:
Dustin Rodrigues 2017-03-19 15:13:29 -04:00
parent 962cb2224a
commit 175ba6551c
1 changed files with 10 additions and 0 deletions

View File

@ -58,3 +58,13 @@ class PIM(dpkt.Packet):
if not self.sum:
self.sum = dpkt.in_cksum(dpkt.Packet.__bytes__(self))
return dpkt.Packet.__bytes__(self)
def test_pim():
pimdata = PIM(b'\x20\x00\x9f\xf4\x00\x01\x00\x02\x00\x69')
assert pimdata.v == 2
assert pimdata.type == 0
# test setters
pimdata.v = 3
pimdata.type = 1
assert bytes(pimdata) == b'\x31\x00\x9f\xf4\x00\x01\x00\x02\x00\x69'