diff options
author | Zachary Scott <e@zzak.io> | 2015-06-03 18:44:51 -0400 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2015-06-03 18:44:51 -0400 |
commit | aaa144bebfc3c0e77078cfbcc42ce5477e7cb05d (patch) | |
tree | 56a19931a93c478cac311fad8ed7e1a11206ee57 | |
parent | 0b702d6cd2ba29ea836d9a4e5cc75f9c9211f258 (diff) | |
download | ruby-openssl-aaa144bebfc3c0e77078cfbcc42ce5477e7cb05d.tar.gz |
Upstream tests for OpenSSL::TestRandom from ruby/ruby@643dced
-rw-r--r-- | test/test_random.rb | 16 |
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) |