From b5597cc833e105c070c028c8e8f91a93ebcdcf24 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 12 Apr 2019 23:39:43 +0100 Subject: [PATCH] Fix indentation goof in CRC test suite. In crypt.testCRC32(), I had intended to test every input byte with each of several previous states, but I mis-indented what should have been the inner loop (over bytes), with the effect that instead I silently tested the input bytes with only the last of those states. --- test/cryptsuite.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/cryptsuite.py b/test/cryptsuite.py index ed32d109..a34f6c8a 100755 --- a/test/cryptsuite.py +++ b/test/cryptsuite.py @@ -998,13 +998,13 @@ class crypt(MyTestBase): for prior in test_prior_values: prior_shifted = shift8(prior) - for i in range(256): - exp = shift8(i) ^ prior_shifted - self.assertEqual(crc32_update(prior, struct.pack("B", i)), exp) + for i in range(256): + exp = shift8(i) ^ prior_shifted + self.assertEqual(crc32_update(prior, struct.pack("B", i)), exp) - # Check linearity of the _reference_ implementation, while - # we're at it! - self.assertEqual(shift8(i ^ prior), exp) + # Check linearity of the _reference_ implementation, while + # we're at it! + self.assertEqual(shift8(i ^ prior), exp) def testCRCDA(self): def pattern(badblk, otherblks, pat):