Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_checksum(self):
"""Verifies that checksum calculation is correct"""
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x00*\x01\x009TPM'),
13421,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x01*\x01\x001PJ2'),
21370,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x02*\x01\x006K3J'),
16523,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
icmp.checksum(b'\x08\x00\x00\x00\x02*\x01\x006K3J'),
16523,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\xb4$\x01\x0012344'),
29866,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00$F\x01\x00fag'),
22533,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x8cH\x01\x00random text goes here'),
47464,
"Checksum validation failed (odd length)"
)
def test_checksum(self):
"""Verifies that checksum calculation is correct"""
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x00*\x01\x009TPM'),
13421,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x01*\x01\x001PJ2'),
21370,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x02*\x01\x006K3J'),
16523,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\xb4$\x01\x0012344'),
29866,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00$F\x01\x00fag'),
22533,
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\xb4$\x01\x0012344'),
29866,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00$F\x01\x00fag'),
22533,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x8cH\x01\x00random text goes here'),
47464,
"Checksum validation failed (odd length)"
)
icmp.checksum(b'\x08\x00\x00\x00\x00*\x01\x009TPM'),
13421,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x01*\x01\x001PJ2'),
21370,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x02*\x01\x006K3J'),
16523,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\xb4$\x01\x0012344'),
29866,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00$F\x01\x00fag'),
22533,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x8cH\x01\x00random text goes here'),
47464,
icmp.checksum(b'\x08\x00\x00\x00\x01*\x01\x001PJ2'),
21370,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x02*\x01\x006K3J'),
16523,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\xb4$\x01\x0012344'),
29866,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00$F\x01\x00fag'),
22533,
"Checksum validation failed (odd length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x8cH\x01\x00random text goes here'),
47464,
"Checksum validation failed (odd length)"
)
def test_checksum(self):
"""Verifies that checksum calculation is correct"""
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x00*\x01\x009TPM'),
13421,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x01*\x01\x001PJ2'),
21370,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x02*\x01\x006K3J'),
16523,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\x03*\x01\x00COSA'),
17757,
"Checksum validation failed (even length)"
)
self.assertEqual(
icmp.checksum(b'\x08\x00\x00\x00\xb4$\x01\x0012344'),
29866,