summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zlib.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-03-25 06:12:45 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-03-25 06:12:45 (GMT)
commit88440960f9f430581ba5766aee1f0712ac96cb54 (patch)
tree763bc7cbf8bf1205ff1a1f3b91a4cd40bfdf61e4 /Lib/test/test_zlib.py
parent4677fbf7de591d0cea0d1aeaa9639ee46faa48f5 (diff)
downloadcpython-88440960f9f430581ba5766aee1f0712ac96cb54.zip
cpython-88440960f9f430581ba5766aee1f0712ac96cb54.tar.gz
cpython-88440960f9f430581ba5766aee1f0712ac96cb54.tar.bz2
A stab in the dark attempt to fix the alpha/tru64 buildbot problem and add more
test coverage of valid inputs to zlib.crc32.
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r--Lib/test/test_zlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 9f0fe18..0c96842 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -53,6 +53,15 @@ class ChecksumTestCase(unittest.TestCase):
self.assertEqual(binascii.crc32(foo), zlib.crc32(foo))
self.assertEqual(binascii.crc32('spam'), zlib.crc32('spam'))
+ def test_negative_crc_iv_input(self):
+ # The range of valid input values for the crc state should be
+ # -2**31 through 2**32-1 to allow inputs artifically constrained
+ # to a signed 32-bit integer.
+ self.assertEqual(zlib.crc32('ham', -1), zlib.crc32('ham', 0xffffffffL))
+ self.assertEqual(zlib.crc32('spam', -3141593),
+ zlib.crc32('spam', 0xffd01027L))
+ self.assertEqual(zlib.crc32('spam', -(2**31)),
+ zlib.crc32('spam', (2**31)))
class ExceptionTestCase(unittest.TestCase):