* test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small

encodings by preselecting codepoints.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2016-06-06 08:29:38 +00:00
Родитель c487224f48
Коммит a4ccbb63cd
2 изменённых файлов: 16 добавлений и 1 удалений

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

@ -1,3 +1,8 @@
Mon Jun 6 17:29:35 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small
encodings by preselecting codepoints.
Mon Jun 6 17:10:50 2016 Kazuki Yamaguchi <k@rhe.jp>
* ext/openssl/ossl_cipher.c (ossl_cipher_free): Use EVP_CIPHER_CTX_free()

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

@ -99,11 +99,21 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase
end
def self.generate_casefold_tests (encoding)
all_tests
# preselect codepoints to speed up testing for small encodings
codepoints = @@codepoints.select do |code|
begin
code.encode(encoding)
true
rescue Encoding::UndefinedConversionError
false
end
end
all_tests.each do |test|
attributes = test.attributes.map(&:to_s).join '-'
attributes.prepend '_' unless attributes.empty?
define_method "test_#{encoding}_#{test.method_name}#{attributes}" do
@@codepoints.each do |code|
codepoints.each do |code|
begin
source = code.encode(encoding) * 5
target = test.first_data[code].encode(encoding) + test.follow_data[code].encode(encoding) * 4