[pypy-svn] r46991 - in pypy/dist/pypy/rlib: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 28 11:13:26 CEST 2007
Author: arigo
Date: Fri Sep 28 11:13:26 2007
New Revision: 46991
Modified:
pypy/dist/pypy/rlib/rsha.py
pypy/dist/pypy/rlib/test/test_rsha.py
Log:
assert tested or broken
Modified: pypy/dist/pypy/rlib/rsha.py
==============================================================================
--- pypy/dist/pypy/rlib/rsha.py (original)
+++ pypy/dist/pypy/rlib/rsha.py Fri Sep 28 11:13:26 2007
@@ -262,7 +262,7 @@
to efficiently compute the digests of strings that share
a common initial substring.
"""
- clone = RMD5()
+ clone = RSHA()
clone._copyfrom(self)
return clone
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:13:26 2007
@@ -27,6 +27,16 @@
self.check("a" * 1000000,
"34aa973cd4c4daa4f61eeb2bdbad27316534016f")
+ def test_copy(self):
+ import sha
+ for repeat in [1, 10, 100]:
+ d1 = rsha.sha("abc" * repeat)
+ d2 = d1.copy()
+ d1.update("def" * repeat)
+ d2.update("gh" * repeat)
+ assert d1.digest() == sha.sha("abc"*repeat+"def"*repeat).digest()
+ assert d2.digest() == sha.sha("abc"*repeat+"gh"*repeat).digest()
+
def test_random(self):
import random, sha
for i in range(20):
More information about the Pypy-commit
mailing list