summaryrefslogtreecommitdiff
path: root/test/openssl
diff options
context:
space:
mode:
Diffstat (limited to 'test/openssl')
-rw-r--r--test/openssl/test_random.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/openssl/test_random.rb b/test/openssl/test_random.rb
new file mode 100644
index 0000000000..e4242acf18
--- /dev/null
+++ b/test/openssl/test_random.rb
@@ -0,0 +1,16 @@
+begin
+ require "openssl"
+rescue LoadError
+end
+
+class OpenSSL::TestRandom < Test::Unit::TestCase
+ def test_random_bytes
+ assert_equal("", OpenSSL::Random.random_bytes(0))
+ assert_equal(12, OpenSSL::Random.random_bytes(12).bytesize)
+ end
+
+ def test_pseudo_bytes
+ assert_equal("", OpenSSL::Random.pseudo_bytes(0))
+ assert_equal(12, OpenSSL::Random.pseudo_bytes(12).bytesize)
+ end
+end if defined?(OpenSSL::Random)