ruby-changes:43221
From: duerst <ko1@a...>
Date: Mon, 6 Jun 2016 17:29:42 +0900 (JST)
Subject: [ruby-changes:43221] duerst:r55295 (trunk): * test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small
duerst 2016-06-06 17:29:38 +0900 (Mon, 06 Jun 2016) New Revision: 55295 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55295 Log: * test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small encodings by preselecting codepoints. Modified files: trunk/ChangeLog trunk/test/ruby/enc/test_case_comprehensive.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 55294) +++ ChangeLog (revision 55295) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jun 6 17:29:35 2016 Martin Duerst <duerst@i...> + + * 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@r...> * ext/openssl/ossl_cipher.c (ossl_cipher_free): Use EVP_CIPHER_CTX_free() Index: test/ruby/enc/test_case_comprehensive.rb =================================================================== --- test/ruby/enc/test_case_comprehensive.rb (revision 55294) +++ test/ruby/enc/test_case_comprehensive.rb (revision 55295) @@ -99,11 +99,21 @@ class TestComprehensiveCaseFold < Test:: https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L99 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/