Skip to content

Commit

Permalink
Merge pull request #351 from dtrodrigues/sll
Browse files Browse the repository at this point in the history
add sll tests
  • Loading branch information
brifordwylie committed Mar 20, 2017
2 parents 962cb22 + d3a9914 commit 51ffabd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dpkt/sll.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,16 @@ def unpack(self, buf):
setattr(self, self.data.__class__.__name__.lower(), self.data)
except (KeyError, dpkt.UnpackError):
pass

def test_sll():
slldata = b'\x00\x00\x00\x01\x00\x06\x00\x0b\xdb\x52\x0e\x08\xf6\x7f\x08\x00\x45\x00\x00\x34\xcc\x6c\x40\x00\x40\x06\x74\x08\x82\xd9\xfa\x8e\x82\xd9\xfa\x0d'
slltest = SLL(slldata)
assert slltest.type == 0
assert slltest.hrd == 1
assert slltest.hlen == 6
assert slltest.hdr == b'\x00\x0b\xdb\x52\x0e\x08\xf6\x7f'
assert slltest.ethtype == 0x0800

# give invalid ethtype of 0x1234 to make sure error is caught
slldata2 = b'\x00\x00\x00\x01\x00\x06\x00\x0b\xdb\x52\x0e\x08\xf6\x7f\x12\x34\x45\x00\x00\x34\xcc\x6c\x40\x00\x40\x06\x74\x08\x82\xd9\xfa\x8e\x82\xd9\xfa\x0d'
slltest = SLL(slldata2)

0 comments on commit 51ffabd

Please sign in to comment.