bdb/test/stat_test.rb

23 lines
488 B
Ruby
Raw Normal View History

require 'test_helper'
2008-12-29 06:43:02 +01:00
class DbStat < Test::Unit::TestCase
def setup
mkdir File.join(File.dirname(__FILE__), 'tmp')
end
def teardown
rm_rf File.join(File.dirname(__FILE__), 'tmp')
end
def test_stat
2008-12-29 06:43:02 +01:00
@db = Bdb::Db.new
@db.open(nil, File.join(File.dirname(__FILE__), 'tmp', 'test.db'), nil, Bdb::Db::BTREE, Bdb::DB_CREATE, 0)
@db.put(nil, 'key', 'data', 0)
stats = @db.stat(nil, 0)
assert_equal 1, stats['bt_nkeys']
@db.close(0)
end
end