Skip to content

Commit

Permalink
Merge pull request #349 from dtrodrigues/tcp
Browse files Browse the repository at this point in the history
test gettting, setting header offset in TCP
  • Loading branch information
brifordwylie committed Mar 20, 2017
2 parents 51ffabd + e7d7e16 commit 7f72ec6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dpkt/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,16 @@ def test_parse_opts():
opts = parse_opts(buf)
assert opts == [None]

def test_offset():
tcpheader = TCP(b'\x01\xbb\xc0\xd7\xb6\x56\xa8\xb9\xd1\xac\xaa\xb1\x50\x18\x40\x00\x56\xf8\x00\x00')
assert tcpheader.off == 5

# test setting header offset
tcpheader.off = 8
assert bytes(tcpheader) == b'\x01\xbb\xc0\xd7\xb6\x56\xa8\xb9\xd1\xac\xaa\xb1\x80\x18\x40\x00\x56\xf8\x00\x00'

if __name__ == '__main__':
# Runs all the test associated with this class/file
test_parse_opts()
test_offset()
print('Tests Successful...')

0 comments on commit 7f72ec6

Please sign in to comment.