summaryrefslogtreecommitdiff
path: root/pgpwordlist/funcs_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-12-31 22:02:21 +0200
committerLars Wirzenius <liw@liw.fi>2016-12-31 22:02:21 +0200
commit23683ca2bc1d9dd07e4ebee6ba348a5e7eaee1bb (patch)
treebe30ed4198375c1215117b5535776775502489a7 /pgpwordlist/funcs_tests.py
parent9d4e2bf3432907d305839e731a22c2f4796c651d (diff)
downloadpy_pgpwordlist-23683ca2bc1d9dd07e4ebee6ba348a5e7eaee1bb.tar.gz
Add get_hex function to get hex from word
Diffstat (limited to 'pgpwordlist/funcs_tests.py')
-rw-r--r--pgpwordlist/funcs_tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pgpwordlist/funcs_tests.py b/pgpwordlist/funcs_tests.py
index e4f6805..a7d1bfb 100644
--- a/pgpwordlist/funcs_tests.py
+++ b/pgpwordlist/funcs_tests.py
@@ -39,3 +39,10 @@ class WordListQueriesTests(unittest.TestCase):
even_words.add(even_word)
odd_words.add(odd_word)
+ def test_round_trip_works(self):
+ for i in range(256):
+ hex = '%02x' % i
+ even_word = pgpwordlist.get_word(hex, 0)
+ odd_word = pgpwordlist.get_word(hex, 1)
+ self.assertEqual(pgpwordlist.get_hex(even_word), hex)
+ self.assertEqual(pgpwordlist.get_hex(odd_word), hex)