2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2016-05-18 03:24:02 -04:00
|
|
|
require_relative "utils"
|
2015-02-12 04:36:55 -05:00
|
|
|
|
2016-05-18 00:07:47 -04:00
|
|
|
class OpenSSL::TestRandom < OpenSSL::TestCase
|
2015-02-12 04:36:55 -05:00
|
|
|
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
|
2016-06-05 08:38:34 -04:00
|
|
|
# deprecated as of OpenSSL 1.1.0
|
2015-02-12 04:36:55 -05:00
|
|
|
assert_equal("", OpenSSL::Random.pseudo_bytes(0))
|
|
|
|
assert_equal(12, OpenSSL::Random.pseudo_bytes(12).bytesize)
|
2016-06-05 08:38:34 -04:00
|
|
|
end if OpenSSL::Random.methods.include?(:pseudo_bytes)
|
2016-05-18 04:06:23 -04:00
|
|
|
end if defined?(OpenSSL::TestCase)
|