n.c.
[chise/ruby.git] / test / test-utf8.rb
diff --git a/test/test-utf8.rb b/test/test-utf8.rb
new file mode 100755 (executable)
index 0000000..9cd816d
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
+
+require "common"
+require "chise/utf8"
+
+class TestUtf8 < Test::Unit::TestCase
+  include CHISE::UTF8Value
+  def test_utf8
+    u8 = "字" # U+5B57 (0x8E9A): CJK Unified Ideograph
+    assert_equal(23383, u8toi(u8))
+    assert_equal(u8, itou8(23383))
+    assert_equal("\375\242\200\210\263\216", itou8(1644203214))
+    assert_equal(1644203214, u8toi("\375\242\200\210\263\216"))
+  end
+end