Commits

Jeff Hardy  committed b54e606

Fix decompressobj.unused_data and .unconsumed_tail

  • Participants
  • Parent commits ba92874

Comments (0)

Files changed (1)

File IronPython.Zlib/run_tests.py

 
 import zlib
 
-#def test_crc32_basic():
-#   calculated_crc32 = zlib.crc32("\xFF") & 0xFFFFFFFF
-#   correct_crc32 = 0xFF000000
-#   if calculated_crc32 != correct_crc32:
-#       raise AssertionError("CRC32 value incorrect %08X" % (calculated_crc32,))
+def test_crc32_basic():
+   calculated_crc32 = zlib.crc32("\xFF") & 0xFFFFFFFF
+   correct_crc32 = 0xFF000000
+   if calculated_crc32 != correct_crc32:
+       raise AssertionError("CRC32 value incorrect %08X" % (calculated_crc32,))
 
-#def test_resume_negative_crc32():
-#   previous_crc32 = -1
-#   calculated_crc32 = zlib.crc32("", previous_crc32)
-#   if calculated_crc32 != previous_crc32:
-#       raise AssertionError("CRC32 should not change if empty string is added %08X" % (calculated_crc32,))
+def test_resume_negative_crc32():
+   previous_crc32 = -1
+   calculated_crc32 = zlib.crc32("", previous_crc32)
+   if calculated_crc32 != previous_crc32:
+       raise AssertionError("CRC32 should not change if empty string is added %08X" % (calculated_crc32,))
 
 def test_decompressobj_unused_data():
    s = "\x03\x00leftover" # minimal two byte stream plus eight bytes trailer
    if dco.unused_data != s[2:]:
        raise AssertionError("Instead of last eight bytes, got %r" % (dco.unused_data,))
 
+test_crc32_basic()
+test_resume_negative_crc32()
 test_decompressobj_unused_data()
 
 # import gzip