mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
c487224f48
commit
a4ccbb63cd
2 changed files with 16 additions and 1 deletions
|
@ -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>
|
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()
|
* ext/openssl/ossl_cipher.c (ossl_cipher_free): Use EVP_CIPHER_CTX_free()
|
||||||
|
|
|
@ -99,11 +99,21 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_casefold_tests (encoding)
|
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|
|
all_tests.each do |test|
|
||||||
attributes = test.attributes.map(&:to_s).join '-'
|
attributes = test.attributes.map(&:to_s).join '-'
|
||||||
attributes.prepend '_' unless attributes.empty?
|
attributes.prepend '_' unless attributes.empty?
|
||||||
define_method "test_#{encoding}_#{test.method_name}#{attributes}" do
|
define_method "test_#{encoding}_#{test.method_name}#{attributes}" do
|
||||||
@@codepoints.each do |code|
|
codepoints.each do |code|
|
||||||
begin
|
begin
|
||||||
source = code.encode(encoding) * 5
|
source = code.encode(encoding) * 5
|
||||||
target = test.first_data[code].encode(encoding) + test.follow_data[code].encode(encoding) * 4
|
target = test.first_data[code].encode(encoding) + test.follow_data[code].encode(encoding) * 4
|
||||||
|
|
Loading…
Add table
Reference in a new issue