digest-murmurhash 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Rakefile +1 -2
- data/digest-murmurhash.gemspec +5 -8
- data/ext/digest/murmurhash/extconf.rb +0 -3
- data/ext/digest/murmurhash/murmurhash.c +121 -202
- data/ext/digest/murmurhash/murmurhash.h +23 -55
- data/ext/digest/murmurhash/murmurhash1.c +35 -47
- data/ext/digest/murmurhash/murmurhash1.h +0 -2
- data/ext/digest/murmurhash/murmurhash2.c +35 -48
- data/ext/digest/murmurhash/murmurhash2.h +0 -2
- data/ext/digest/murmurhash/murmurhash2a.c +41 -62
- data/ext/digest/murmurhash/murmurhash2a.h +0 -2
- data/ext/digest/murmurhash/murmurhash64a.c +40 -52
- data/ext/digest/murmurhash/murmurhash64a.h +0 -3
- data/ext/digest/murmurhash/murmurhash64b.c +56 -68
- data/ext/digest/murmurhash/murmurhash64b.h +0 -2
- data/ext/digest/murmurhash/murmurhash_aligned2.c +39 -51
- data/ext/digest/murmurhash/murmurhash_aligned2.h +0 -2
- data/ext/digest/murmurhash/murmurhash_neutral2.c +39 -51
- data/ext/digest/murmurhash/murmurhash_neutral2.h +0 -2
- data/lib/digest/murmurhash.rb +72 -6
- data/spec/digest_spec.rb +20 -19
- data/spec/exception_spec.rb +4 -4
- data/spec/mem_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +26 -27
- data/lib/digest/murmurhash/version.rb +0 -5
data/spec/digest_spec.rb
CHANGED
@@ -2,31 +2,32 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Digest::MurmurHash do
|
4
4
|
it "seed" do
|
5
|
-
|
5
|
+
all_classes.each do |c|
|
6
6
|
m = c.new
|
7
|
-
expect(c::DEFAULT_SEED
|
7
|
+
expect(c::DEFAULT_SEED).to eq(m.seed)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
it "seed=" do
|
12
|
-
|
12
|
+
all_classes.each do |c|
|
13
13
|
m = c.new
|
14
14
|
m.update "murmurhash"
|
15
15
|
before_digest = m.hexdigest
|
16
16
|
m.seed = (c::DEFAULT_SEED.length == 4) ? seed32 : seed64
|
17
|
-
expect(c::DEFAULT_SEED
|
18
|
-
expect(before_digest
|
17
|
+
expect(c::DEFAULT_SEED).not_to eq(m.seed)
|
18
|
+
expect(before_digest).not_to eq(m.hexdigest)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it "initialize" do
|
23
|
-
|
24
|
-
expect(c.new).to be_a_kind_of(Digest::
|
23
|
+
all_classes.each do |c|
|
24
|
+
expect(c.new).to be_a_kind_of(Digest::Class)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
it "digest and hexdigest" do
|
29
|
-
|
29
|
+
expect(Digest::MurmurHash1.hexdigest("abc")).to eq("dc5f5755")
|
30
|
+
all_classes.each do |c|
|
30
31
|
[:digest, :hexdigest].each do |method|
|
31
32
|
str = "a" * 1024
|
32
33
|
d = c.send(method, str)
|
@@ -35,13 +36,13 @@ describe Digest::MurmurHash do
|
|
35
36
|
expect(d2).to be_a_kind_of(String)
|
36
37
|
expect(d.length).to be > 0
|
37
38
|
expect(d2.length).to be > 0
|
38
|
-
expect(d != d2).to
|
39
|
+
expect(d != d2).to be_truthy
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
it "rawdigest" do
|
44
|
-
|
45
|
+
all_classes.each do |c|
|
45
46
|
str = "a" * 1024
|
46
47
|
d = c.rawdigest str
|
47
48
|
d2 = c.rawdigest str, (c::DEFAULT_SEED.length == 4) ? seed32 : seed64
|
@@ -49,12 +50,12 @@ describe Digest::MurmurHash do
|
|
49
50
|
expect(d2).to be_a_kind_of(Integer)
|
50
51
|
expect(d).to be > 0
|
51
52
|
expect(d2).to be > 0
|
52
|
-
expect(d != d2).to
|
53
|
+
expect(d != d2).to be_truthy
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
it "update and reset and hexdigest(32bit)" do
|
57
|
-
|
58
|
+
all_classes.each do |c|
|
58
59
|
murmur = c.new
|
59
60
|
murmur.update("m").update("u").update("r")
|
60
61
|
murmur << "m" << "u" << "r"
|
@@ -67,35 +68,35 @@ describe Digest::MurmurHash do
|
|
67
68
|
end
|
68
69
|
|
69
70
|
it "==" do
|
70
|
-
|
71
|
+
all_classes.each do |c|
|
71
72
|
["", "murmur", "murmurhash" * 1024].each do |str|
|
72
73
|
murmur1 = c.new
|
73
74
|
murmur2 = c.new
|
74
|
-
expect(murmur1.update(str) == murmur2.update(str)).to
|
75
|
+
expect(murmur1.update(str) == murmur2.update(str)).to be_truthy
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
79
80
|
it "dup" do
|
80
|
-
|
81
|
+
all_classes.each do |c|
|
81
82
|
murmur1 = c.new
|
82
83
|
murmur2 = c.new
|
83
84
|
10.times {
|
84
85
|
murmur1 = murmur1.update("murmurhash" * 100).dup
|
85
86
|
}
|
86
87
|
murmur2.update(("murmurhash" * 100) * 10)
|
87
|
-
expect(murmur1
|
88
|
+
expect(murmur1).to eq(murmur2)
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
91
92
|
it "length" do
|
92
|
-
|
93
|
-
expect(c.new.length == c::DEFAULT_SEED.length).to
|
93
|
+
all_classes.each do |c|
|
94
|
+
expect(c.new.length == c::DEFAULT_SEED.length).to be_truthy
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
97
98
|
it "to_i" do
|
98
|
-
|
99
|
+
all_classes.each do |c|
|
99
100
|
expect(c.new.update("murmurhash").to_i).to be_a_kind_of(Integer)
|
100
101
|
end
|
101
102
|
end
|
data/spec/exception_spec.rb
CHANGED
@@ -2,20 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe MurmurHash do
|
4
4
|
it "update nil" do
|
5
|
-
|
5
|
+
all_classes.each do |c|
|
6
6
|
murmur = c.new
|
7
7
|
expect{ murmur.update }.to raise_error(ArgumentError)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
it "rawdigest no arguments" do
|
12
|
-
|
12
|
+
all_classes.each do |c|
|
13
13
|
expect{ c.rawdigest }.to raise_error(ArgumentError)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
it "seed digest" do
|
18
|
-
|
18
|
+
all_classes.each do |c|
|
19
19
|
expect{ c.digest "", ""}.to raise_error(ArgumentError)
|
20
20
|
expect{ c.digest "", "\x00" }.to raise_error(ArgumentError)
|
21
21
|
seed = (c::DEFAULT_SEED.bytesize == 4) ? seed32 : seed64
|
@@ -24,7 +24,7 @@ describe MurmurHash do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "seed instance" do
|
27
|
-
|
27
|
+
all_classes.each do |c|
|
28
28
|
murmur = c.new
|
29
29
|
expect{ murmur.seed = "" }.to raise_error(ArgumentError)
|
30
30
|
expect{ murmur.seed = "\x00" }.to raise_error(ArgumentError)
|
data/spec/mem_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-murmurhash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: digest-
|
14
|
+
name: digest-simple
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake-compiler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
82
|
+
version: '0'
|
83
83
|
description: Digest::MurmurHash is class collections of use algorithm MurmurHash desiged
|
84
84
|
by Austin Appleby.
|
85
85
|
email: co000ri@gmail.com
|
@@ -88,8 +88,8 @@ extensions:
|
|
88
88
|
- ext/digest/murmurhash/extconf.rb
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .gitignore
|
92
|
-
- .travis.yml
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
93
|
- Gemfile
|
94
94
|
- LICENSE.txt
|
95
95
|
- README.md
|
@@ -113,7 +113,6 @@ files:
|
|
113
113
|
- ext/digest/murmurhash/murmurhash_neutral2.c
|
114
114
|
- ext/digest/murmurhash/murmurhash_neutral2.h
|
115
115
|
- lib/digest/murmurhash.rb
|
116
|
-
- lib/digest/murmurhash/version.rb
|
117
116
|
- spec/bench.rb
|
118
117
|
- spec/digest_spec.rb
|
119
118
|
- spec/exception_spec.rb
|
@@ -129,17 +128,17 @@ require_paths:
|
|
129
128
|
- lib
|
130
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
130
|
requirements:
|
132
|
-
- -
|
131
|
+
- - ">="
|
133
132
|
- !ruby/object:Gem::Version
|
134
133
|
version: '0'
|
135
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
135
|
requirements:
|
137
|
-
- -
|
136
|
+
- - ">="
|
138
137
|
- !ruby/object:Gem::Version
|
139
138
|
version: '0'
|
140
139
|
requirements: []
|
141
140
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.1
|
141
|
+
rubygems_version: 2.4.1
|
143
142
|
signing_key:
|
144
143
|
specification_version: 4
|
145
144
|
summary: Digest::MurmurHash is class collections of use algorithm MurmurHash desiged
|