diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-21 07:14:03 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-21 07:14:03 +0000 |
commit | c9e923617398f0dd74125341c03d0c9bdece216b (patch) | |
tree | 59e81a8e9aee66553db37f23ad0ffd02404e7765 /test/ruby | |
parent | 8ee8a6f93c0e4f6b62f00e4cb181faf21e81d2f9 (diff) | |
download | ruby-c9e923617398f0dd74125341c03d0c9bdece216b.tar.gz |
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
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/enc/test_case_comprehensive.rb | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb index aee4331aa6..6d561d6d33 100644 --- a/test/ruby/enc/test_case_comprehensive.rb +++ b/test/ruby/enc/test_case_comprehensive.rb @@ -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 |