2008-12-29 06:14:29 +01:00
|
|
|
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
|
2008-12-29 06:14:29 +01:00
|
|
|
|
|
|
|
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)
|
2008-12-29 06:14:29 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|