update.
[chise/ruby.git] / test / test-char.rb
index 5e36c4c..f26e53c 100755 (executable)
@@ -28,6 +28,21 @@ class TestCharacter < Test::Unit::TestCase
     assert_raise(RuntimeError){ char.nosuchmethod(0) }
   end
 
+  def test_each
+    "字".each_feature {|f, v|
+      #qp f, v
+      assert_instance_of(String, f)
+    }
+
+    h = "字".hash_feature
+    assert_instance_of(Hash, h)
+  end
+
+  def test_bignum
+    char = CHISE::Character.get(1644203214)
+    assert_equal("\375\242\200\210\263\216",   char.to_s)
+  end
+
   def test_latin
     char = "A".char
     assert_equal(65, char.ascii)
@@ -39,7 +54,6 @@ class TestCharacter < Test::Unit::TestCase
   end
 
   def test_to_er
-    #assert_equal("&J90-3B7A;",        "字".char.to_er)
     assert_equal("&#x5b57;",   "字".char.to_er)
     assert_equal("&#x5b57;",   "&M-06942;".de_er.char.to_er)
     assert_equal("&#x2166b;",  "&M-06000;".de_er.char.to_er)
@@ -59,9 +73,11 @@ class TestCharacter < Test::Unit::TestCase
 
   def test_put
     char = "字".char
-    char["test_attribute"] = "test"
-    assert_equal("test", char.test_attribute)
-    char["test_attribute"] = "test2"
-    assert_equal("test2", char.test_attribute)
+    #qp char.test_feature
+    char.test_feature = "test1"
+    assert_equal("test1", char.test_feature)
+    #qp char.test_feature
+    char.test_feature = "test2"
+    assert_equal("test2", char.test_feature)
   end
 end