From: Zooko O'Whielacronx Date: Fri, 15 Feb 2008 03:20:19 +0000 (-0700) Subject: add unit test asserting that allmydata.util.base32 matches rfc 3548 X-Git-Tag: allmydata-tahoe-0.8.0~48 X-Git-Url: https://git.rkrishnan.org/pf/COPYING.TGPPL.html?a=commitdiff_plain;h=5942fca1e1cc74deb97767e713506ea6cbb19ec2;p=tahoe-lafs%2Ftahoe-lafs.git add unit test asserting that allmydata.util.base32 matches rfc 3548 --- diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index 9ece5e7b..1a8a4d1b 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -11,6 +11,14 @@ from allmydata.util import assertutil, fileutil, testutil, deferredutil class Base32(unittest.TestCase): + def test_b2a_matches_Pythons(self): + import base64 + y = "\x12\x34\x45\x67\x89\x0a\xbc\xde\xf0" + x = base64.b32encode(y) + while x and x[-1] == '=': + x = x[:-1] + x = x.lower() + self.failUnlessEqual(base32.b2a(y), x) def test_b2a(self): self.failUnlessEqual(base32.b2a("\x12\x34"), "ci2a") def test_b2a_or_none(self):