]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
add unit test asserting that allmydata.util.base32 matches rfc 3548
authorZooko O'Whielacronx <zooko@zooko.com>
Fri, 15 Feb 2008 03:20:19 +0000 (20:20 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Fri, 15 Feb 2008 03:20:19 +0000 (20:20 -0700)
src/allmydata/test/test_util.py

index 9ece5e7b48c8b4feb67ad563c6bb66c913ee7a3b..1a8a4d1bb06bb9c84aeef1c539faea5c41df0d62 100644 (file)
@@ -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):