bdb1 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes +15 -2
- data/VERSION +1 -1
- data/bdb1.gemspec +12 -12
- data/ext/bdb1/bdb1.c +151 -272
- data/ext/bdb1/bdb1.h +2 -26
- data/ext/bdb1/delegate.c +44 -64
- data/ext/bdb1/extconf.rb +0 -18
- data/ext/bdb1/recnum.c +65 -178
- data/test/test_btree.rb +7 -3
- data/test/test_hash.rb +2 -30
- metadata +55 -86
data/test/test_btree.rb
CHANGED
@@ -251,7 +251,7 @@ class TestBtree < Test::Unit::TestCase
|
|
251
251
|
|
252
252
|
def test_04_btree
|
253
253
|
sub_btree_delete_2
|
254
|
-
|
254
|
+
sub_key
|
255
255
|
sub_convert
|
256
256
|
sub_sh
|
257
257
|
sub_sh_call
|
@@ -268,13 +268,17 @@ class TestBtree < Test::Unit::TestCase
|
|
268
268
|
intern_btree_delete
|
269
269
|
end
|
270
270
|
|
271
|
-
def
|
271
|
+
def sub_key
|
272
272
|
lines = @hash.keys
|
273
273
|
array = []
|
274
274
|
10.times do
|
275
275
|
h = lines[rand(lines.size - 1)]
|
276
276
|
array.push h
|
277
|
-
|
277
|
+
if @hash.respond_to?(:key)
|
278
|
+
assert_equal(@hash.key(h.reverse), @bdb.key(h.reverse), "<key>")
|
279
|
+
else
|
280
|
+
assert_equal(@hash.index(h.reverse), @bdb.index(h.reverse), "<index>")
|
281
|
+
end
|
278
282
|
end
|
279
283
|
assert_equal(@hash.values_at(array), @bdb.values_at(array), "<values_at>")
|
280
284
|
end
|
data/test/test_hash.rb
CHANGED
@@ -46,7 +46,6 @@ class TestHash < Test::Unit::TestCase
|
|
46
46
|
sub_file_delete
|
47
47
|
sub_file_cursor
|
48
48
|
sub_file_reopen
|
49
|
-
sub_file_dup
|
50
49
|
sub_file_close
|
51
50
|
end
|
52
51
|
|
@@ -132,39 +131,12 @@ class TestHash < Test::Unit::TestCase
|
|
132
131
|
|
133
132
|
def sub_file_reopen
|
134
133
|
assert_equal(nil, @bdb.close, "<close>")
|
135
|
-
assert_kind_of(BDB1::
|
134
|
+
assert_kind_of(BDB1::Hash, @bdb = BDB1::Hash.open(tmpdir("aa"), "w",
|
136
135
|
"set_flags" => BDB1::DUP),
|
137
136
|
"<reopen with DB_DUP>")
|
138
137
|
assert_equal(0, @bdb.size, "<must be 0 after reopen>")
|
139
138
|
end
|
140
139
|
|
141
|
-
def sub_file_dup
|
142
|
-
assert_equal("a", @bdb["0"] = "a", "<set dup>")
|
143
|
-
assert_equal("b", @bdb["0"] = "b", "<set dup>")
|
144
|
-
assert_equal("c", @bdb["0"] = "c", "<set dup>")
|
145
|
-
assert_equal("d", @bdb["0"] = "d", "<set dup>")
|
146
|
-
assert_equal("aa", @bdb["1"] = "aa", "<set dup>")
|
147
|
-
assert_equal("bb", @bdb["1"] = "bb", "<set dup>")
|
148
|
-
assert_equal("cc", @bdb["1"] = "cc", "<set dup>")
|
149
|
-
assert_equal("aaa", @bdb["2"] = "aaa", "<set dup>")
|
150
|
-
assert_equal("bbb", @bdb["2"] = "bbb", "<set dup>")
|
151
|
-
assert_equal("aaaa", @bdb["3"] = "aaaa", "<set dup>")
|
152
|
-
rep = [["a", "b", "c", "d"], ['aa', 'bb', 'cc'], ['aaa', 'bbb'], ['aaaa']]
|
153
|
-
for i in [0, 1, 2, 3]
|
154
|
-
k0, v0 = [], []
|
155
|
-
@bdb.duplicates(i.to_s).each {|k, v| k0 << k; v0 << v}
|
156
|
-
assert_equal(k0, [i.to_s] * (4 - i), "<dup key #{i}>")
|
157
|
-
assert_equal(v0.sort, rep[i], "<dup val #{i}>")
|
158
|
-
k0, v0 = [], []
|
159
|
-
@bdb.each_dup(i.to_s) {|k, v| k0 << k; v0 << v}
|
160
|
-
assert_equal(k0, [i.to_s] * (4 - i), "<dup key #{i}>")
|
161
|
-
assert_equal(v0.sort, rep[i], "<dup val #{i}>")
|
162
|
-
v0 = []
|
163
|
-
@bdb.each_dup_value(i.to_s) {|v| v0 << v}
|
164
|
-
assert_equal(v0.sort, rep[i], "<dup val #{i}>")
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
140
|
def sub_file_close
|
169
141
|
assert_equal(nil, @bdb.close, "<close>")
|
170
142
|
end
|
@@ -193,7 +165,7 @@ class TestHash < Test::Unit::TestCase
|
|
193
165
|
assert_equal(nil, @bdb.close, "<close>")
|
194
166
|
end
|
195
167
|
|
196
|
-
def
|
168
|
+
def test_04_hash
|
197
169
|
sub_index
|
198
170
|
sub_convert
|
199
171
|
sub_has
|
metadata
CHANGED
@@ -1,95 +1,70 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bdb1
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 4
|
10
|
-
version: 0.2.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Guy Decoux
|
14
9
|
- Akinori MUSHA
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
requirement: &
|
13
|
+
date: 2012-01-02 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: &17208288240 !ruby/object:Gem::Requirement
|
23
18
|
none: false
|
24
|
-
requirements:
|
19
|
+
requirements:
|
25
20
|
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 23
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
- 0
|
21
|
+
- !ruby/object:Gem::Version
|
32
22
|
version: 1.0.0
|
33
|
-
version_requirements: *id001
|
34
|
-
name: bundler
|
35
|
-
prerelease: false
|
36
23
|
type: :development
|
37
|
-
|
38
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *17208288240
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: jeweler
|
28
|
+
requirement: &17208287760 !ruby/object:Gem::Requirement
|
39
29
|
none: false
|
40
|
-
requirements:
|
30
|
+
requirements:
|
41
31
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 7
|
44
|
-
segments:
|
45
|
-
- 1
|
46
|
-
- 6
|
47
|
-
- 4
|
32
|
+
- !ruby/object:Gem::Version
|
48
33
|
version: 1.6.4
|
49
|
-
version_requirements: *id002
|
50
|
-
name: jeweler
|
51
|
-
prerelease: false
|
52
34
|
type: :development
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
version_requirements: *id003
|
64
|
-
name: rcov
|
65
35
|
prerelease: false
|
36
|
+
version_requirements: *17208287760
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rcov
|
39
|
+
requirement: &17208287280 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
66
45
|
type: :development
|
67
|
-
|
68
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *17208287280
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake-compiler
|
50
|
+
requirement: &17208303160 !ruby/object:Gem::Requirement
|
69
51
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
hash: 17
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
- 7
|
77
|
-
- 9
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
78
55
|
version: 0.7.9
|
79
|
-
version_requirements: *id004
|
80
|
-
name: rake-compiler
|
81
|
-
prerelease: false
|
82
56
|
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *17208303160
|
83
59
|
description: This is a Ruby interface to Berkeley DB 1.85 and 1.86.
|
84
60
|
email: knu@idaemons.org
|
85
61
|
executables: []
|
86
|
-
|
87
|
-
extensions:
|
62
|
+
extensions:
|
88
63
|
- ext/bdb1/extconf.rb
|
89
|
-
extra_rdoc_files:
|
64
|
+
extra_rdoc_files:
|
90
65
|
- LICENSE.txt
|
91
66
|
- README.md
|
92
|
-
files:
|
67
|
+
files:
|
93
68
|
- .document
|
94
69
|
- Changes
|
95
70
|
- Gemfile
|
@@ -117,37 +92,31 @@ files:
|
|
117
92
|
- test/test_recnum.rb
|
118
93
|
- test/tmp/.keep_me
|
119
94
|
homepage: http://github.com/knu/ruby-bdb1
|
120
|
-
licenses:
|
95
|
+
licenses:
|
121
96
|
- Ruby's
|
122
97
|
post_install_message:
|
123
98
|
rdoc_options: []
|
124
|
-
|
125
|
-
require_paths:
|
99
|
+
require_paths:
|
126
100
|
- lib
|
127
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
102
|
none: false
|
129
|
-
requirements:
|
130
|
-
- -
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
|
133
|
-
segments:
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
segments:
|
134
108
|
- 0
|
135
|
-
|
136
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
hash: 1557529169043602632
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
111
|
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
segments:
|
143
|
-
- 0
|
144
|
-
version: "0"
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
145
116
|
requirements: []
|
146
|
-
|
147
117
|
rubyforge_project:
|
148
|
-
rubygems_version: 1.8.
|
118
|
+
rubygems_version: 1.8.5
|
149
119
|
signing_key:
|
150
120
|
specification_version: 3
|
151
121
|
summary: A Ruby interface to Berkeley DB 1.85 and 1.86
|
152
122
|
test_files: []
|
153
|
-
|