9cd816d599afba69ab56dd73d4db73aaa0f33de9
[chise/ruby.git] / test / test-utf8.rb
1 #!/usr/bin/env ruby
2 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
3
4 require "common"
5 require "chise/utf8"
6
7 class TestUtf8 < Test::Unit::TestCase
8   include CHISE::UTF8Value
9   def test_utf8
10     u8 = "字" # U+5B57 (0x8E9A): CJK Unified Ideograph
11     assert_equal(23383, u8toi(u8))
12     assert_equal(u8, itou8(23383))
13     assert_equal("\375\242\200\210\263\216", itou8(1644203214))
14     assert_equal(1644203214, u8toi("\375\242\200\210\263\216"))
15   end
16 end