test/base32_test.rb in base32-0.3.1 vs test/base32_test.rb in base32-0.3.2
- old
+ new
@@ -82,9 +82,17 @@
assert_equal(32, Base32.random_base32(29).length)
assert_match(/^[A-Z2-7]{1}={7}$/, Base32.random_base32(1))
assert_match(/^[A-Z2-7]{29}={3}$/, Base32.random_base32(29))
end
+ def test_random_base32_padding
+ assert_equal(32, Base32.random_base32(32, false).length)
+ assert_equal(40, Base32.random_base32(40, false).length)
+ assert_equal(29, Base32.random_base32(29, false).length)
+ assert_match(/^[A-Z2-7]{1}$/, Base32.random_base32(1, false))
+ assert_match(/^[A-Z2-7]{29}$/, Base32.random_base32(29, false))
+ end
+
def test_assign_new_table
new_table = 'abcdefghijklmnopqrstuvwxyz234567'
Base32.table = new_table
assert_equal(new_table, Base32.table)
Base32.table = Base32::TABLE # so as not to ruin other tests