1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add assertions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-02-19 08:33:01 +00:00
parent 460bb8a829
commit 1efa14169a

View file

@ -110,6 +110,8 @@ if defined? DBM
assert(File.zero?(dirname))
when /\bGDBM\b/
assert_equal(%w[.dir .pag], suffixes)
assert(!File.zero?(pagname))
assert(!File.zero?(dirname))
pag = File.binread(pagname, 16)
pag_magics = [
0x13579ace, # GDBM_OMAGIC
@ -124,11 +126,14 @@ if defined? DBM
end
when /\bBerkeley DB\b/
assert_equal(%w[.db], suffixes)
assert(!File.zero?(dbname))
db = File.binread(dbname, 16)
assert(db[0,4].unpack("N") == [0x00061561] || # Berkeley DB 1
db[12,4].unpack("L") == [0x00061561]) # Berkeley DBM 2 or later.
when /\bQDBM\b/
assert_equal(%w[.dir .pag], suffixes)
assert(!File.zero?(pagname))
assert(!File.zero?(dirname))
dir = File.binread(dirname, 16)
assert_equal("[depot]\0\v", dir[0, 9])
pag = File.binread(pagname, 16)