* test/openssl/test_engine.rb: add first tests for builtin "openssl"

engine.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
emboss 2011-11-04 00:33:11 +00:00
Родитель 00bfe1940e
Коммит 3463615a69
2 изменённых файлов: 43 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Fri Nov 04 01:31:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* test/openssl/test_engine.rb: add first tests for builtin "openssl"
engine.
Fri Nov 04 08:41:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* ext/openssl/extconf.rb:

Просмотреть файл

@ -1,7 +1,5 @@
require_relative 'utils'
if defined?(OpenSSL)
class OpenSSL::TestEngine < Test::Unit::TestCase
def test_engines_free # [ruby-dev:44173]
@ -11,6 +9,42 @@ class OpenSSL::TestEngine < Test::Unit::TestCase
OpenSSL::Engine.cleanup # [ruby-core:40669]
end
end
def test_openssl_engine_builtin
engine = OpenSSL::Engine.load("openssl")
assert_equal(true, engine)
assert_equal(1, OpenSSL::Engine.engines.size)
cleanup
end
def test_openssl_engine_by_id_string
engine = OpenSSL::Engine.by_id("openssl")
assert_not_nil(engine)
assert_equal(1, OpenSSL::Engine.engines.size)
cleanup
end
def test_openssl_engine_id_name_inspect
engine = OpenSSL::Engine.by_id("openssl")
assert_equal("openssl", engine.id)
assert_not_nil(engine.name)
assert_not_nil(engine.inspect)
cleanup
end
def test_openssl_engine_digest_sha1
engine = OpenSSL::Engine.by_id("openssl")
digest = engine.digest("SHA1")
assert_not_nil(digest)
data = "test"
assert_equal(OpenSSL::Digest::SHA1.digest(data), digest.digest(data))
end
private
def cleanup
OpenSSL::Engine.cleanup
assert_equal(0, OpenSSL::Engine::engines.size)
end
end if defined?(OpenSSL)
end