[pypy-svn] r46990 - pypy/dist/pypy/rlib/test

arigo at codespeak.net arigo at codespeak.net
Fri Sep 28 11:10:49 CEST 2007


Author: arigo
Date: Fri Sep 28 11:10:49 2007
New Revision: 46990

Modified:
   pypy/dist/pypy/rlib/test/test_rsha.py
Log:
A randomized test port from cfbolz in test_rmd5.


Modified: pypy/dist/pypy/rlib/test/test_rsha.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rsha.py	(original)
+++ pypy/dist/pypy/rlib/test/test_rsha.py	Fri Sep 28 11:10:49 2007
@@ -26,3 +26,14 @@
     def disabled_too_slow_test_case_3(self):
         self.check("a" * 1000000,
                    "34aa973cd4c4daa4f61eeb2bdbad27316534016f")
+
+    def test_random(self):
+        import random, sha
+        for i in range(20):
+            input = ''.join([chr(random.randrange(256))
+                             for i in range(random.randrange(1000))])
+            m1 = rsha.RSHA()
+            m1.update(input)
+            m2 = sha.new()
+            m2.update(input)
+            assert m2.hexdigest() == m1.hexdigest()



More information about the Pypy-commit mailing list