i
[chise/ruby.git] / test / test-db.rb
index 4c64dc4..c94a2d6 100755 (executable)
@@ -5,20 +5,17 @@
 require "common"
 
 class TestBDB < Test::Unit::TestCase
-#class TestBDB
   def test_bdb
     @config = CHISE::Config.instance
     dir = @config.db_dir
     assert_match(%r|/chise/char-db\Z|, dir)
 
     file = dir+"/=jis-x0208/system-char-id"
-#   db = BDB::Hash.open(file, nil, BDB::CREATE | BDB::EXCL)
     db = BDB::Hash.open(file, nil, 0)
-#   qp db
   end
 
   def test_db
-#    @cdb = CHISE::CharDB.instance
+#   @cdb = CHISE::CharDB.instance
 #   @sdb = CHISE::CodesysDB.instance
   end
 
@@ -27,52 +24,9 @@ class TestBDB < Test::Unit::TestCase
   end
 end
 
-#class TC_DB < Test::Unit::TestCase
-class TestDataBase
-  def setup
-    @cdb = CHISE::CharDB.instance
-    @sdb = CHISE::CodesysDB.instance
-  end
-
-  def test_db
-    assert_equal("()+!", CHISE::DB.unix_to_win("<>*?"))
-    assert_equal("<>*?", CHISE::DB.win_to_unix("()+!"))
-  end
-
-  def test_each_db(db)
-    assert_instance_of(Array, db.keys)
-  end
-
-  def test_make_db(db)
-    h = {"a" => 1, "b" => 2, "c" => 3}
-    db.remove_db("test-db") #\82Ü\82¸\8dÅ\8f\89\82É\8fÁ\82µ\82Ä\82¨\82­
-    assert_not_nil(db.make_db("test-db", h))
-    assert_not_nil(db.open_db("test-db"))
-    assert_equal(1, db.get("test-db", "a"))
-    assert_equal(2, db.get("test-db", "b"))
-    assert_equal(3, db.get("test-db", "c"))
-    db.remove_db("test-db") #\8dÅ\8cã\82É\82Ü\82½\8fÁ\82µ\82Ä\82¨\82­
-  end
-
-  def test_dbs
-    test_each_db(@cdb)
-    test_each_db(@sdb)
-#    test_make_db(@cdb)
-#    test_make_db(@sdb)
-  end
-
-  def test_db_put
-    char = "\8e\9a".char
-    char.put_char_attribute("test-attribute", "test")
-    assert_equal("test", char.test_attribute)
-  end
-
-end
-
 class TestCodesys < Test::Unit::TestCase
-#class TestCodesys
-  def setup
-#    @db = CHISE::CodesysDB.instance
+  def nusetup
+    @db = CHISE::CodesysDB.instance
   end
 
   def test_dummy
@@ -134,5 +88,4 @@ class TestCodesys < Test::Unit::TestCase
     assert_equal(8481, ks.first)
     assert_equal(29566, ks.last)
   end
-
 end