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.
@@ -2,31 +2,32 @@ require 'spec_helper'
2
2
 
3
3
  describe Digest::MurmurHash do
4
4
  it "seed" do
5
- all.each do |c|
5
+ all_classes.each do |c|
6
6
  m = c.new
7
- expect(c::DEFAULT_SEED == m.seed).to be true
7
+ expect(c::DEFAULT_SEED).to eq(m.seed)
8
8
  end
9
9
  end
10
10
 
11
11
  it "seed=" do
12
- all.each do |c|
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 != m.seed).to be true
18
- expect(before_digest != m.hexdigest).to be true
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
- all.each do |c|
24
- expect(c.new).to be_a_kind_of(Digest::StringBuffer)
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
- all.each do |c|
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 be true
39
+ expect(d != d2).to be_truthy
39
40
  end
40
41
  end
41
42
  end
42
43
 
43
44
  it "rawdigest" do
44
- all.each do |c|
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 be true
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
- all.each do |c|
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
- all.each do |c|
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 be_true
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
- all.each do |c|
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 == murmur2).to be_true
88
+ expect(murmur1).to eq(murmur2)
88
89
  end
89
90
  end
90
91
 
91
92
  it "length" do
92
- all.each do |c|
93
- expect(c.new.length == c::DEFAULT_SEED.length).to be true
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
- all.each do |c|
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
@@ -2,20 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  describe MurmurHash do
4
4
  it "update nil" do
5
- all.each do |c|
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
- all.each do |c|
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
- all.each do |c|
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
- all.each do |c|
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)
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe MurmurHash do
4
4
  it "gc safe" do
5
- all.each do |c|
5
+ all_classes.each do |c|
6
6
  murmur = c.new
7
7
  init = murmur.to_s
8
8
  GC.start
@@ -1,7 +1,7 @@
1
1
  require 'digest/murmurhash'
2
2
  include Digest
3
3
 
4
- def all
4
+ def all_classes
5
5
  [
6
6
  MurmurHash1,
7
7
  MurmurHash2,
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.3.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-01-04 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: digest-stringbuffer
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.0.2
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.0.2
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: '1.3'
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: '1.3'
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: '2.11'
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: '2.11'
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.8.3
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.8.3
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.11
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
@@ -1,5 +0,0 @@
1
- module Digest
2
- class MurmurHash
3
- VERSION = "0.3.0"
4
- end
5
- end