diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-01 04:12:13 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-01 04:12:13 +0000 |
commit | 00bf4e8a84c59f051b87c1a613fe8544b86c5aa6 (patch) | |
tree | 16c3b20fdeef94d7040d42c49340b08711fda2de /test/ruby/test_m17n_comb.rb | |
parent | fe7d645eed6eef0eb0132982e2b1f4e286163eb5 (diff) | |
download | ruby-00bf4e8a84c59f051b87c1a613fe8544b86c5aa6.tar.gz |
* test/ruby/allpairs.rb: new file for all pairs method.
* test/ruby/test_m17n_comb.rb: use allpairs.rb to reduce test cases.
* test/ruby/test_sprintf_comb.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n_comb.rb')
-rw-r--r-- | test/ruby/test_m17n_comb.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb index a3dcde3283..e69d6fadc8 100644 --- a/test/ruby/test_m17n_comb.rb +++ b/test/ruby/test_m17n_comb.rb @@ -1,5 +1,7 @@ require 'test/unit' require 'stringio' +require 'require_relative' +require_relative 'allpairs' class TestM17NComb < Test::Unit::TestCase def assert_encoding(encname, actual, message=nil) @@ -113,20 +115,8 @@ class TestM17NComb < Test::Unit::TestCase #"aaa".force_encoding("utf-32be"), ] - def combination(*args) - args = args.map {|a| a.to_a } - i = 0 - while true - n = i - as = [] - args.reverse_each {|a| - n, m = n.divmod(a.length) - as.unshift a[m] - } - break if 0 < n - yield as - i += 1 - end + def combination(*args, &b) + AllPairs.each(*args, &b) end def encdump(str) |