Back to index

python3.2  3.2.2
Public Member Functions
test.test_zlib.ChecksumTestCase Class Reference

List of all members.

Public Member Functions

def test_crc32start
def test_crc32empty
def test_adler32start
def test_adler32empty
def assertEqual32
def test_penguins
def test_crc32_adler32_unsigned
def test_same_as_binascii_crc32

Detailed Description

Definition at line 16 of file test_zlib.py.


Member Function Documentation

def test.test_zlib.ChecksumTestCase.assertEqual32 (   self,
  seen,
  expected 
)

Definition at line 36 of file test_zlib.py.

00036 
00037     def assertEqual32(self, seen, expected):
00038         # 32-bit values masked -- checksums on 32- vs 64- bit machines
00039         # This is important if bit 31 (0x08000000L) is set.
00040         self.assertEqual(seen & 0x0FFFFFFFF, expected & 0x0FFFFFFFF)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 31 of file test_zlib.py.

00031 
00032     def test_adler32empty(self):
00033         self.assertEqual(zlib.adler32(b"", 0), 0)
00034         self.assertEqual(zlib.adler32(b"", 1), 1)
00035         self.assertEqual(zlib.adler32(b"", 432), 432)

Here is the call graph for this function:

Definition at line 27 of file test_zlib.py.

00027 
00028     def test_adler32start(self):
00029         self.assertEqual(zlib.adler32(b""), zlib.adler32(b"", 1))
00030         self.assertTrue(zlib.adler32(b"abc", 0xffffffff))

Here is the call graph for this function:

Definition at line 50 of file test_zlib.py.

00050 
00051     def test_crc32_adler32_unsigned(self):
00052         foo = b'abcdefghijklmnop'
00053         # explicitly test signed behavior
00054         self.assertEqual(zlib.crc32(foo), 2486878355)
00055         self.assertEqual(zlib.crc32(b'spam'), 1138425661)
00056         self.assertEqual(zlib.adler32(foo+foo), 3573550353)
00057         self.assertEqual(zlib.adler32(b'spam'), 72286642)

Here is the call graph for this function:

Definition at line 22 of file test_zlib.py.

00022 
00023     def test_crc32empty(self):
00024         self.assertEqual(zlib.crc32(b"", 0), 0)
00025         self.assertEqual(zlib.crc32(b"", 1), 1)
00026         self.assertEqual(zlib.crc32(b"", 432), 432)

Here is the call graph for this function:

Definition at line 18 of file test_zlib.py.

00018 
00019     def test_crc32start(self):
00020         self.assertEqual(zlib.crc32(b""), zlib.crc32(b"", 0))
00021         self.assertTrue(zlib.crc32(b"abc", 0xffffffff))

Here is the call graph for this function:

Definition at line 41 of file test_zlib.py.

00041 
00042     def test_penguins(self):
00043         self.assertEqual32(zlib.crc32(b"penguin", 0), 0x0e5c1a120)
00044         self.assertEqual32(zlib.crc32(b"penguin", 1), 0x43b6aa94)
00045         self.assertEqual32(zlib.adler32(b"penguin", 0), 0x0bcf02f6)
00046         self.assertEqual32(zlib.adler32(b"penguin", 1), 0x0bd602f7)
00047 
00048         self.assertEqual(zlib.crc32(b"penguin"), zlib.crc32(b"penguin", 0))
00049         self.assertEqual(zlib.adler32(b"penguin"),zlib.adler32(b"penguin",1))

Here is the call graph for this function:

Definition at line 58 of file test_zlib.py.

00058 
00059     def test_same_as_binascii_crc32(self):
00060         foo = b'abcdefghijklmnop'
00061         crc = 2486878355
00062         self.assertEqual(binascii.crc32(foo), crc)
00063         self.assertEqual(zlib.crc32(foo), crc)
00064         self.assertEqual(binascii.crc32(b'spam'), zlib.crc32(b'spam'))
00065 
00066 
# Issue #10276 - check that inputs >=4GB are handled correctly.

Here is the call graph for this function:


The documentation for this class was generated from the following file: