test/test_hash.rb in bdb1-0.2.4 vs test/test_hash.rb in bdb1-0.2.5

- old
+ new

@@ -44,11 +44,10 @@ sub_file_init sub_file_get_set sub_file_delete sub_file_cursor sub_file_reopen - sub_file_dup sub_file_close end def sub_file_init assert_kind_of(BDB1::Hash, @bdb = BDB1::Hash.new(tmpdir("aa"), "a"), "<open>") @@ -130,43 +129,16 @@ assert_equal(array, arr.sort, "<order>") end def sub_file_reopen assert_equal(nil, @bdb.close, "<close>") - assert_kind_of(BDB1::Btree, @bdb = BDB1::Btree.open(tmpdir("aa"), "w", + assert_kind_of(BDB1::Hash, @bdb = BDB1::Hash.open(tmpdir("aa"), "w", "set_flags" => BDB1::DUP), "<reopen with DB_DUP>") assert_equal(0, @bdb.size, "<must be 0 after reopen>") end - def sub_file_dup - assert_equal("a", @bdb["0"] = "a", "<set dup>") - assert_equal("b", @bdb["0"] = "b", "<set dup>") - assert_equal("c", @bdb["0"] = "c", "<set dup>") - assert_equal("d", @bdb["0"] = "d", "<set dup>") - assert_equal("aa", @bdb["1"] = "aa", "<set dup>") - assert_equal("bb", @bdb["1"] = "bb", "<set dup>") - assert_equal("cc", @bdb["1"] = "cc", "<set dup>") - assert_equal("aaa", @bdb["2"] = "aaa", "<set dup>") - assert_equal("bbb", @bdb["2"] = "bbb", "<set dup>") - assert_equal("aaaa", @bdb["3"] = "aaaa", "<set dup>") - rep = [["a", "b", "c", "d"], ['aa', 'bb', 'cc'], ['aaa', 'bbb'], ['aaaa']] - for i in [0, 1, 2, 3] - k0, v0 = [], [] - @bdb.duplicates(i.to_s).each {|k, v| k0 << k; v0 << v} - assert_equal(k0, [i.to_s] * (4 - i), "<dup key #{i}>") - assert_equal(v0.sort, rep[i], "<dup val #{i}>") - k0, v0 = [], [] - @bdb.each_dup(i.to_s) {|k, v| k0 << k; v0 << v} - assert_equal(k0, [i.to_s] * (4 - i), "<dup key #{i}>") - assert_equal(v0.sort, rep[i], "<dup val #{i}>") - v0 = [] - @bdb.each_dup_value(i.to_s) {|v| v0 << v} - assert_equal(v0.sort, rep[i], "<dup val #{i}>") - end - end - def sub_file_close assert_equal(nil, @bdb.close, "<close>") end def test_02_memory @@ -191,10 +163,10 @@ def sub_memory_close assert_equal(nil, @bdb.close, "<close>") end - def test_04_btree + def test_04_hash sub_index sub_convert sub_has sub_sh sub_sh_call