summaryrefslogtreecommitdiff
path: root/trunk/test/ruby/enc/test_gb18030.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
commitd0233291bc8a5068e52c69c210e5979e5324b5bc (patch)
tree7d9459449c33792c63eeb7baa071e76352e0baab /trunk/test/ruby/enc/test_gb18030.rb
parent0dc342de848a642ecce8db697b8fecd83a63e117 (diff)
parent72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff)
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/test/ruby/enc/test_gb18030.rb')
-rw-r--r--trunk/test/ruby/enc/test_gb18030.rb125
1 files changed, 0 insertions, 125 deletions
diff --git a/trunk/test/ruby/enc/test_gb18030.rb b/trunk/test/ruby/enc/test_gb18030.rb
deleted file mode 100644
index a33a9eb28e..0000000000
--- a/trunk/test/ruby/enc/test_gb18030.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-require "test/unit"
-
-class TestGB18030 < Test::Unit::TestCase
- def s(s)
- s.force_encoding("gb18030")
- end
-
- def test_mbc_enc_len
- assert_equal(1, s("\x81\x40").size)
- assert_equal(1, s("\x81\x30\x81\x30").size)
- end
-
- def test_mbc_to_code
- assert_equal(0x8140, s("\x81\x40").ord)
- end
-
- def test_code_to_mbc
- assert_equal(s("\x81\x40"), 0x8140.chr("gb18030"))
- end
-
- def test_mbc_case_fold
- r = Regexp.new(s("(\x81\x40)\\1"), "i")
- assert_match(r, s("\x81\x40\x81\x40"))
- end
-
- def scheck(c, i)
- assert_equal(s(c.reverse.take(c.size - i).join), s(c.reverse.join).chop)
- end
-
- def fcheck(c)
- assert_raise(ArgumentError) { s(c.reverse.join).chop }
- end
-
- def test_left_adjust_char_head
- # C1: 00-2f, 3a-3f, 7f, ff
- # C2: 40-7e, 80
- # C4: 30-39
- # CM: 81-fe
- c1 = "\x2f"
- c2 = "\x40"
- c4 = "\x30"
- cm = "\x81"
-
- # S_START-c1
- # S_START-c2-S_one_C2-0
- # S_START-c2-S_one_C2-c1
- # S_START-c2-S_one_C2-cm-S_odd_CM_one_CX-c1
- # S_START-c2-S_one_C2-cm-S_odd_CM_one_CX-cm-S_even_CM_one_CX-c1
- # S_START-c2-S_one_C2-cm-S_odd_CM_one_CX-cm-S_even_CM_one_CX-cm-S_odd_CM_one_CX(rec)
- # S_START-c4-S_one_C4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c4-S_one_C4_even_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c4-S_one_C4_even_CMC4-cm-S_odd_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c4-S_one_C4_even_CMC4-cm-S_odd_CMC4-c4-S_one_C4_odd_CMC4(rec)
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c4-S_one_C4_even_CMC4-cm-S_odd_CMC4-cm-S_odd_CM_odd_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c4-S_one_C4_even_CMC4-cm-S_odd_CMC4-cm-S_odd_CM_odd_CMC4-cm-S_even_CM_odd_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-c4-S_one_C4_even_CMC4-cm-S_odd_CMC4-cm-S_odd_CM_odd_CMC4-cm-S_even_CM_odd_CMC4-cm-S_odd_CM_odd_CMC4(rec)
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-cm-S_odd_CM_even_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-cm-S_odd_CM_even_CMC4-cm-S_even_CM_even_CMC4-c1
- # S_START-c4-S_one_C4-cm-S_one_CMC4-c4-S_one_C4_odd_CMC4-cm-S_even_CMC4-cm-S_odd_CM_even_CMC4-cm-S_even_CM_even_CMC4-cm-S_odd_CM_even_CMC4(rec)
- # S_START-c4-S_one_C4-cm-S_one_CMC4-cm-S_even_CM_one_CX(rec)
- # S_START-cm-S_one_CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c4-S_even_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c4-S_even_C4CM-cm-S_one_CM_even_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c4-S_even_C4CM-cm-S_one_CM_even_C4CM-c4-S_odd_C4CM(rec)
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c4-S_even_C4CM-cm-S_one_CM_even_C4CM-cm-S_even_CM_even_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c4-S_even_C4CM-cm-S_one_CM_even_C4CM-cm-S_even_CM_even_C4CM-cm-S_odd_CM_even_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-c4-S_even_C4CM-cm-S_one_CM_even_C4CM-cm-S_even_CM_even_C4CM-cm-S_odd_CM_even_C4CM-cm-S_even_CM_even_C4CM(rec)
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-cm-S_even_CM_odd_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-cm-S_even_CM_odd_C4CM-cm-S_odd_CM_odd_C4CM-c1
- # S_START-cm-S_one_CM-c4-S_odd_C4CM-cm-S_one_CM_odd_C4CM-cm-S_even_CM_odd_C4CM-cm-S_odd_CM_odd_C4CM-cm-S_even_CM_odd_C4CM(rec)
- # S_START-cm-S_one_CM-cm-S_odd_CM_one_CX(rec)
-
- scheck([c1], 1)
- scheck([c2], 1)
- scheck([c2, c1], 1)
- scheck([c2, cm, c1], 2)
- scheck([c2, cm, cm, c1], 1)
- scheck([c2, cm, cm, cm], 2)
- scheck([c4], 1)
- scheck([c4, c1], 1)
- scheck([c4, cm], 2)
- fcheck([c4, cm, c1])
- fcheck([c4, cm, c4, c1])
- scheck([c4, cm, c4, cm], 4)
- scheck([c4, cm, c4, cm, c1], 4)
- scheck([c4, cm, c4, cm, c4], 4)
- scheck([c4, cm, c4, cm, c4, c1], 4)
- fcheck([c4, cm, c4, cm, c4, cm])
- fcheck([c4, cm, c4, cm, c4, cm, c1])
- fcheck([c4, cm, c4, cm, c4, cm, c4])
- scheck([c4, cm, c4, cm, c4, cm, cm, c1], 4)
- fcheck([c4, cm, c4, cm, c4, cm, cm, cm])
- fcheck([c4, cm, c4, cm, c4, cm, cm, cm, c1])
- scheck([c4, cm, c4, cm, c4, cm, cm, cm, cm], 4)
- fcheck([c4, cm, c4, cm, cm, c1])
- scheck([c4, cm, c4, cm, cm, cm], 4)
- scheck([c4, cm, c4, cm, cm, cm, c1], 4)
- fcheck([c4, cm, c4, cm, cm, cm, cm])
- scheck([c4, cm, cm], 1)
- scheck([cm], 1)
- fcheck([cm, c1])
- fcheck([cm, c4, c1])
- scheck([cm, c4, cm], 3)
- fcheck([cm, c4, cm, c1])
- fcheck([cm, c4, cm, c4])
- fcheck([cm, c4, cm, c4, c1])
- fcheck([cm, c4, cm, c4, cm])
- fcheck([cm, c4, cm, c4, cm, c1])
- fcheck([cm, c4, cm, c4, cm, c4])
- fcheck([cm, c4, cm, c4, cm, cm, c1])
- fcheck([cm, c4, cm, c4, cm, cm, cm])
- fcheck([cm, c4, cm, c4, cm, cm, cm, c1])
- fcheck([cm, c4, cm, c4, cm, cm, cm, cm])
- fcheck([cm, c4, cm, cm, c1])
- fcheck([cm, c4, cm, cm, cm])
- fcheck([cm, c4, cm, cm, cm, c1])
- fcheck([cm, c4, cm, cm, cm, cm])
- scheck([cm, cm], 2)
- end
-end