aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_random.rb
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2015-06-03 18:44:51 -0400
committerZachary Scott <e@zzak.io>2015-06-03 18:44:51 -0400
commitaaa144bebfc3c0e77078cfbcc42ce5477e7cb05d (patch)
tree56a19931a93c478cac311fad8ed7e1a11206ee57 /test/test_random.rb
parent0b702d6cd2ba29ea836d9a4e5cc75f9c9211f258 (diff)
downloadruby-openssl-aaa144bebfc3c0e77078cfbcc42ce5477e7cb05d.tar.gz
Upstream tests for OpenSSL::TestRandom from ruby/ruby@643dced
Diffstat (limited to 'test/test_random.rb')
-rw-r--r--test/test_random.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_random.rb b/test/test_random.rb
new file mode 100644
index 00000000..e4242acf
--- /dev/null
+++ b/test/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)