bloomer 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/README.md +16 -5
- data/Rakefile +9 -3
- data/bloomer.gemspec +2 -1
- data/lib/bloomer/version.rb +1 -1
- data/{spec/bloomer_spec.rb → test/bloomer_test.rb} +22 -22
- data/test/test_helper.rb +2 -0
- metadata +100 -89
- data/spec/spec_helper.rb +0 -7
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Bloomer: Bloom filters with elastic
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/mceachen/bloomer.png)](http://travis-ci.org/mceachen/bloomer)
|
4
|
+
|
3
5
|
[Bloom filters](http://en.wikipedia.org/wiki/Bloom_filter) are great for quickly checking to see if
|
4
6
|
a given string has been seen before--in constant time, and using a fixed amount of RAM, as long
|
5
7
|
as you know the expected number of elements up front. If you add more than ```capacity``` elements to the filter,
|
@@ -61,10 +63,19 @@ new_b.include? "a"
|
|
61
63
|
#=> true
|
62
64
|
```
|
63
65
|
|
64
|
-
##
|
66
|
+
## Changelog
|
67
|
+
|
68
|
+
### 0.0.5
|
69
|
+
* Switched from rspec to minitest
|
70
|
+
|
71
|
+
### 0.0.4
|
72
|
+
* Fixed gem packaging
|
73
|
+
|
74
|
+
### 0.0.3
|
75
|
+
* Added support for scalable bloom filters (SBF)
|
65
76
|
|
66
|
-
|
67
|
-
*
|
68
|
-
* 0.0.3 Added support for scalable bloom filters (SBF)
|
69
|
-
* 0.0.4 Fixed gem packaging
|
77
|
+
### 0.0.2
|
78
|
+
* Switch to triple-hash chaining (simpler, faster, and better false-positive rate)
|
70
79
|
|
80
|
+
### 0.0.1
|
81
|
+
* Bloom, there it is.
|
data/Rakefile
CHANGED
@@ -4,7 +4,13 @@ YARD::Rake::YardocTask.new do |t|
|
|
4
4
|
t.files = ['lib/**/*.rb', 'README.md']
|
5
5
|
end
|
6
6
|
|
7
|
-
require
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
require 'rake/testtask'
|
9
8
|
|
10
|
-
|
9
|
+
Rake::TestTask.new do |t|
|
10
|
+
t.libs.push "lib"
|
11
|
+
t.libs.push "test"
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
task :default => :test
|
data/bloomer.gemspec
CHANGED
@@ -22,5 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "bitarray"
|
23
23
|
s.add_development_dependency "rake"
|
24
24
|
s.add_development_dependency "yard"
|
25
|
-
s.add_development_dependency "
|
25
|
+
s.add_development_dependency "minitest"
|
26
|
+
s.add_development_dependency "minitest-reporters"
|
26
27
|
end
|
data/lib/bloomer/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
C = ('a'..'z').to_a
|
4
4
|
def rand_word(length = 8)
|
@@ -12,7 +12,7 @@ def test_bloom(size, max_false_prob, bloom)
|
|
12
12
|
bloom.add(w)
|
13
13
|
set.add(w)
|
14
14
|
end
|
15
|
-
set.each { |ea| bloom.
|
15
|
+
set.each { |ea| bloom.must_include(ea) }
|
16
16
|
tries = size * 3
|
17
17
|
false_hits = 0
|
18
18
|
hits = 0
|
@@ -38,37 +38,37 @@ def test_marshal_state(b)
|
|
38
38
|
inputs = b.capacity.times.collect { rand_word }
|
39
39
|
inputs.each { |ea| b.add(ea) }
|
40
40
|
new_b = Marshal.load(Marshal.dump(b))
|
41
|
-
new_b.count.
|
42
|
-
new_b.capacity.
|
43
|
-
inputs.each { |ea| new_b.
|
41
|
+
new_b.count.must_equal b.count
|
42
|
+
new_b.capacity.must_equal b.capacity
|
43
|
+
inputs.each { |ea| new_b.must_include(ea) }
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_simple(b)
|
47
|
-
b.add("a").
|
48
|
-
b.add("a").
|
49
|
-
b.
|
50
|
-
b.
|
51
|
-
b.
|
52
|
-
b.add("b").
|
53
|
-
b.add("b").
|
54
|
-
b.
|
55
|
-
b.
|
47
|
+
b.add("a").must_equal true
|
48
|
+
b.add("a").must_equal false
|
49
|
+
b.must_include("a")
|
50
|
+
b.wont_include("")
|
51
|
+
b.wont_include("b")
|
52
|
+
b.add("b").must_equal true
|
53
|
+
b.add("b").must_equal false
|
54
|
+
b.must_include("b")
|
55
|
+
b.wont_include("")
|
56
56
|
b.add("")
|
57
|
-
b.
|
57
|
+
b.must_include("")
|
58
58
|
end
|
59
59
|
|
60
60
|
describe Bloomer do
|
61
|
-
it "
|
61
|
+
it "works trivially" do
|
62
62
|
b = Bloomer.new(10, 0.001)
|
63
63
|
test_simple(b)
|
64
64
|
end
|
65
65
|
|
66
|
-
it "
|
66
|
+
it "marshals state correctly" do
|
67
67
|
b = Bloomer.new(10, 0.001)
|
68
68
|
test_marshal_state(b)
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "results in similar-to-expected false positives" do
|
72
72
|
max_false_prob = 0.001
|
73
73
|
size = 50_000
|
74
74
|
b = Bloomer.new(size, max_false_prob)
|
@@ -77,25 +77,25 @@ describe Bloomer do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
describe Bloomer::Scalable do
|
80
|
-
it "
|
80
|
+
it "works trivially" do
|
81
81
|
b = Bloomer::Scalable.new
|
82
82
|
test_simple(b)
|
83
83
|
end
|
84
84
|
|
85
|
-
it "
|
85
|
+
it "marshals state correctly" do
|
86
86
|
b = Bloomer::Scalable.new(10, 0.001)
|
87
87
|
100.times.each { b.add(rand_word) }
|
88
88
|
test_marshal_state(b)
|
89
89
|
end
|
90
90
|
|
91
|
-
it "
|
91
|
+
it "results in similar-to-expected false positives" do
|
92
92
|
max_false_prob = 0.001
|
93
93
|
size = 10_000
|
94
94
|
b = Bloomer::Scalable.new(1024, max_false_prob)
|
95
95
|
test_bloom(size, max_false_prob, b)
|
96
96
|
end
|
97
97
|
|
98
|
-
it "
|
98
|
+
it "results in similar-to-expected false positives" do
|
99
99
|
max_false_prob = 0.01
|
100
100
|
size = 50_000
|
101
101
|
b = Bloomer::Scalable.new(1024, max_false_prob)
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,91 +1,105 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bloomer
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 0.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Matthew McEachen
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
prerelease: false
|
22
|
-
type: :runtime
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
12
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
32
15
|
name: bitarray
|
33
|
-
|
34
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
35
23
|
prerelease: false
|
36
|
-
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
25
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
46
31
|
name: rake
|
47
|
-
|
48
|
-
|
49
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
50
38
|
type: :development
|
51
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
41
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
|
58
|
-
- 0
|
59
|
-
version: "0"
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
60
47
|
name: yard
|
61
|
-
|
62
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
63
55
|
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: minitest
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
64
70
|
type: :development
|
65
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: minitest-reporters
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
89
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
segments:
|
72
|
-
- 2
|
73
|
-
- 7
|
74
|
-
- 0
|
75
|
-
version: 2.7.0
|
76
|
-
name: rspec
|
77
|
-
version_requirements: *id004
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
78
94
|
description: Bloom filters and Scalable Bloom filters (SBF) in pure ruby
|
79
|
-
email:
|
95
|
+
email:
|
80
96
|
- matthew+github@mceachen.org
|
81
97
|
executables: []
|
82
|
-
|
83
98
|
extensions: []
|
84
|
-
|
85
99
|
extra_rdoc_files: []
|
86
|
-
|
87
|
-
files:
|
100
|
+
files:
|
88
101
|
- .gitignore
|
102
|
+
- .travis.yml
|
89
103
|
- Gemfile
|
90
104
|
- MIT-LICENSE
|
91
105
|
- README.md
|
@@ -93,42 +107,39 @@ files:
|
|
93
107
|
- bloomer.gemspec
|
94
108
|
- lib/bloomer.rb
|
95
109
|
- lib/bloomer/version.rb
|
96
|
-
-
|
97
|
-
-
|
110
|
+
- test/bloomer_test.rb
|
111
|
+
- test/test_helper.rb
|
98
112
|
homepage: https://github.com/mceachen/bloomer
|
99
113
|
licenses: []
|
100
|
-
|
101
114
|
post_install_message:
|
102
115
|
rdoc_options: []
|
103
|
-
|
104
|
-
require_paths:
|
116
|
+
require_paths:
|
105
117
|
- lib
|
106
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
119
|
none: false
|
108
|
-
requirements:
|
109
|
-
- -
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
segments:
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
segments:
|
113
125
|
- 0
|
114
|
-
|
115
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
hash: 2624379326334183946
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
128
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
121
|
-
segments:
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
segments:
|
122
134
|
- 0
|
123
|
-
|
135
|
+
hash: 2624379326334183946
|
124
136
|
requirements: []
|
125
|
-
|
126
137
|
rubyforge_project: bloomer
|
127
|
-
rubygems_version: 1.8.
|
138
|
+
rubygems_version: 1.8.21
|
128
139
|
signing_key:
|
129
140
|
specification_version: 3
|
130
141
|
summary: Bloom filters and Scalable Bloom filters (SBF) in pure ruby
|
131
|
-
test_files:
|
132
|
-
-
|
133
|
-
-
|
142
|
+
test_files:
|
143
|
+
- test/bloomer_test.rb
|
144
|
+
- test/test_helper.rb
|
134
145
|
has_rdoc:
|