* 2022-01-18 [ci skip]
[ruby-80x24.org.git] / test / openssl / test_random.rb
blob33af375720f48b53d058d90f9443b88108273110
1 # frozen_string_literal: true
2 require_relative "utils"
4 if defined?(OpenSSL)
6 class OpenSSL::TestRandom < OpenSSL::TestCase
7   def test_random_bytes
8     assert_equal("", OpenSSL::Random.random_bytes(0))
9     assert_equal(12, OpenSSL::Random.random_bytes(12).bytesize)
10   end
12   def test_pseudo_bytes
13     # deprecated as of OpenSSL 1.1.0
14     assert_equal("", OpenSSL::Random.pseudo_bytes(0))
15     assert_equal(12, OpenSSL::Random.pseudo_bytes(12).bytesize)
16   end if OpenSSL::Random.methods.include?(:pseudo_bytes)
17 end
19 end