[pypy-svn] r46966 - in pypy/dist/pypy/rlib: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Sep 27 17:24:36 CEST 2007
Author: cfbolz
Date: Thu Sep 27 17:24:35 2007
New Revision: 46966
Modified:
pypy/dist/pypy/rlib/rmd5.py
pypy/dist/pypy/rlib/test/test_rmd5.py
Log:
a random string sort of test for rmd5. add an encoding declaration in rmd5.py
for Jacobs surname
Modified: pypy/dist/pypy/rlib/rmd5.py
==============================================================================
--- pypy/dist/pypy/rlib/rmd5.py (original)
+++ pypy/dist/pypy/rlib/rmd5.py Thu Sep 27 17:24:35 2007
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
"""
RPython implementation of MD5 checksums.
Modified: pypy/dist/pypy/rlib/test/test_rmd5.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rmd5.py (original)
+++ pypy/dist/pypy/rlib/test/test_rmd5.py Thu Sep 27 17:24:35 2007
@@ -138,3 +138,15 @@
d2 = m2c.hexdigest()
assert d1 == d2
+
+def test_random():
+ import random, md5
+ for i in range(20):
+ input = ''.join([chr(random.randrange(256))
+ for i in range(random.randrange(1000))])
+ m1 = rmd5.RMD5()
+ m1.update(input)
+ m2 = md5.new()
+ m2.update(input)
+ assert m2.hexdigest() == m1.hexdigest()
+
More information about the Pypy-commit
mailing list