1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

It takes still too many memory...

/usr/bin/time -l make RUBYOPT=-w TESTS='-v ruby/enc/test_case_comprehensive.rb' test-all
ruby -v: ruby 2.4.0dev (2016-06-21 trunk 55473) [x86_64-freebsd10.3]
       27.74 real        27.57 user         0.16 sys
    115308  maximum resident set size
         5  average shared memory size
         4  average unshared data size
       128  average unshared stack size
     28443  page reclaims
         0  page faults
         0  swaps
         2  block input operations
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
        93  voluntary context switches
      1123  involuntary context switches

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2016-06-21 07:14:03 +00:00
parent 8ee8a6f93c
commit c9e9236173

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
# Copyright © 2016 Martin J. Dürst (duerst@it.aoyama.ac.jp)
require "test/unit"
@ -36,7 +37,7 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase
end
next if /\A(?:[\#@]|\s*\z)|Surrogate/.match?(line)
data = line.chomp.split('#')[0].split(/;\s*/, 15)
code = data[0].to_i(16).chr('UTF-8')
code = data[0].to_i(16).chr(Encoding::UTF_8)
yield code, data
end
end
@ -130,6 +131,22 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase
@@tests ||= []
end
def self.generate_unicode_case_mapping_tests (encoding)
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|
source = code.encode(encoding) * 5
target = "#{test.first_data[code]}#{test.follow_data[code]*4}".encode(encoding)
result = source.__send__(test.method_name, *test.attributes)
assert_equal target, target,
proc{"from #{code*5} (#{source.dump}) expected #{target.dump} but was #{result.dump}"}
end
end
end
end
def self.generate_case_mapping_tests (encoding)
all_tests
# preselect codepoints to speed up testing for small encodings
@ -261,13 +278,13 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase
generate_case_mapping_tests 'ISO-8859-1'
generate_case_mapping_tests 'US-ASCII'
generate_case_mapping_tests 'ASCII-8BIT'
generate_case_mapping_tests 'UTF-8'
generate_case_mapping_tests 'UTF-16BE'
generate_case_mapping_tests 'UTF-16LE'
generate_case_mapping_tests 'UTF-32BE'
generate_case_mapping_tests 'UTF-32LE'
generate_case_mapping_tests 'ISO-8859-11'
generate_case_mapping_tests 'ISO-8859-8'
generate_case_mapping_tests 'ISO-8859-6'
generate_case_mapping_tests 'Windows-1255'
generate_unicode_case_mapping_tests 'UTF-8'
generate_unicode_case_mapping_tests 'UTF-16BE'
generate_unicode_case_mapping_tests 'UTF-16LE'
generate_unicode_case_mapping_tests 'UTF-32BE'
generate_unicode_case_mapping_tests 'UTF-32LE'
end