murmur_redux 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06f00b7d939be9550463de9a5908d7b48f8b9b94
4
- data.tar.gz: 5098ab2facc729e534429fcb8893c71e8f32e8e0
3
+ metadata.gz: 6120028ad8ef0e982f87e14f20562fa1340a5dcc
4
+ data.tar.gz: 2a5d6875492e07c35ab42a102b4358882397e2f6
5
5
  SHA512:
6
- metadata.gz: 479af7a739dab21bfe03a77920f6bddd3ee826aeccdf131df4548f1338af886f43c280cd931457339d8bca8888a0a8620f70f9b2035ded08ef75ed5087ff47b7
7
- data.tar.gz: 2acfea82922ddc6f6aa07edba5ecf2e55bce70194bb63757b9b5a64737e98ba753fb4ea9f6986a8814b0c13c4c8ae14b69ff85087435e209c0a58de956e052df
6
+ metadata.gz: 880ff7831d0597f967b2fbeb6c674cdd49cd055c6e1482bfca9b397bd5ded25bc961a4476a023edf7ce2d49a408ceae40bfa8b45db79ccdba07a560ddfad5a02
7
+ data.tar.gz: 951b44887394b9cbda557304a33a591578e0eaadbd0d17ce2027996b34a8026572687ccb41a41be18a2484b889bae69e1f29e9ddaca5b16ca34e58d1d157813a
data/.gitignore CHANGED
File without changes
File without changes
File without changes
data/Gemfile CHANGED
@@ -4,6 +4,4 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rake-compiler'
7
- gem 'rspec'
8
- gem 'guard-rspec'
9
7
  end
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # Murmur redux
2
2
 
3
- A simpler wrapper around [murmurhash3](https://github.com/funny-falcon/murmurhash3-ruby) gem with a nicer API.
3
+ A simple wrapper around murmurhash3 C extension originally based on murmurhash3-ruby gem[0]
4
+
5
+ > MurmurHash is a non-cryptographic hash function suitable for general hash-based lookup. It was created by Austin Appleby in , and exists in a number of variants, all of which have been released into the public domain. When compared to other popular hash functions, MurmurHash performed well in a random distribution of regular keys.[1]
4
6
 
5
7
  It defaults to `MurmurHash3_x86_128` which is a nice combination of low latency and with good collision resistence.
6
8
 
9
+ - [0] - [Github repo for murmurhash3-ruby gem](https://github.com/funny-falcon/murmurhash3-ruby)
10
+ - [1] - [Wikipedia article](http://en.wikipedia.org/wiki/MurmurHash)
11
+
7
12
  ## Installation
8
13
 
9
14
  Include the gem in your Gemfile:
data/Rakefile CHANGED
@@ -3,9 +3,13 @@
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rake/testtask'
5
5
  require 'rake/extensiontask'
6
- require 'rspec/core/rake_task'
7
6
 
8
- RSpec::Core::RakeTask.new(:spec)
9
7
  Rake::ExtensionTask.new 'murmur_native'
10
8
 
11
- task :default => [:compile, :spec]
9
+ Rake::TestTask.new do |t|
10
+ t.libs << 'spec'
11
+ t.pattern = 'spec/*_spec.rb'
12
+ t.pattern = 'spec/**/*_spec.rb'
13
+ end
14
+
15
+ task default: %i(compile test)
File without changes
File without changes
File without changes
File without changes
@@ -1,17 +1,15 @@
1
1
  module MurmurRedux
2
- class Hash
3
- class << self
4
- def digest(string)
5
- ints = MurmurRedux::V128.str_hash(string)
2
+ module Hash
3
+ def self.digest(string)
4
+ ints = MurmurRedux::V128.str_hash(string)
6
5
 
7
- generate_hex_string(ints)
8
- end
6
+ generate_hex_string(ints)
7
+ end
9
8
 
10
- private
9
+ private
11
10
 
12
- def generate_hex_string(ints)
13
- ints.pack('L*').unpack('H*').first
14
- end
11
+ def self.generate_hex_string(ints)
12
+ ints.pack('L*').unpack('H*').first
15
13
  end
16
14
  end
17
15
  end
@@ -1,3 +1,3 @@
1
1
  module MurmurRedux
2
- VERSION = '1.0.1' unless defined? MurmurRedux::VERSION
2
+ VERSION = '1.0.3' unless defined? MurmurRedux::VERSION
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.author = 'Marian Posaceanu'
12
12
  gem.email = 'contact@marianposaceanu.com'
13
13
  gem.files = `git ls-files`.split("\n")
14
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.test_files = `git ls-files -- {spec}/*`.split("\n")
15
15
  gem.require_paths = ['lib', 'ext']
16
16
  gem.homepage = 'https://github.com/dakull/murmur_redux'
17
17
  gem.extensions = FileList["ext/**/extconf.rb"]
@@ -0,0 +1,4 @@
1
+ # require 'murmur_redux'
2
+ require 'minitest/autorun'
3
+ require 'minitest/pride'
4
+ require 'murmur_redux'
@@ -1,46 +1,48 @@
1
+ require_relative './minitest_helper.rb'
2
+
1
3
  shared_examples_128 = proc do
2
4
  it 'should make correct hash for string' do
3
- murmur.str_hash('asdfqwer', 0).should eq([0xd6d7d367, 0xcb41f064, 0x8973cd72, 0xc345e72e])
4
- murmur.str_hash('asdfqwerzxcvyui', 0).should eq([0x007b2172f, 0x64ecae1b, 0x1813b5a5, 0x9c674ee6])
5
- murmur.str_hash('asdfqwerzxcvyuio', 0).should eq([0xf508df57, 0xbb38f3fd, 0xf48c9d98, 0xb65c36cd])
6
- murmur.str_hash('asdfqwerzxcvyuio!', 0).should eq([0x8a011755, 0xb13d463f, 0x8386d32a, 0x0df8884c])
5
+ murmur.str_hash('asdfqwer', 0).must_equal([0xd6d7d367, 0xcb41f064, 0x8973cd72, 0xc345e72e])
6
+ murmur.str_hash('asdfqwerzxcvyui', 0).must_equal([0x007b2172f, 0x64ecae1b, 0x1813b5a5, 0x9c674ee6])
7
+ murmur.str_hash('asdfqwerzxcvyuio', 0).must_equal([0xf508df57, 0xbb38f3fd, 0xf48c9d98, 0xb65c36cd])
8
+ murmur.str_hash('asdfqwerzxcvyuio!', 0).must_equal([0x8a011755, 0xb13d463f, 0x8386d32a, 0x0df8884c])
7
9
  end
8
10
 
9
11
  it 'should make correct hash for 32bit integer' do
10
- murmur.int32_hash(1717859169).should eq([0x20b48108, 0x10369ceb, 0x3ad523cc, 0xdacb587f])
11
- murmur.int32_hash(1717859169).should eq(murmur.str_hash('asdf'))
12
+ murmur.int32_hash(1717859169).must_equal([0x20b48108, 0x10369ceb, 0x3ad523cc, 0xdacb587f])
13
+ murmur.int32_hash(1717859169).must_equal(murmur.str_hash('asdf'))
12
14
  end
13
15
 
14
16
  it 'should make correct hash for 64bit integer' do
15
- murmur.int64_hash(0x12345678).should eq(murmur.str_hash("\x78\x56\x34\x12\x00\x00\x00\x00"))
16
- murmur.int64_hash(0x1234567812345678).should eq(murmur.str_hash("\x78\x56\x34\x12\x78\x56\x34\x12"))
17
+ murmur.int64_hash(0x12345678).must_equal(murmur.str_hash("\x78\x56\x34\x12\x00\x00\x00\x00"))
18
+ murmur.int64_hash(0x1234567812345678).must_equal(murmur.str_hash("\x78\x56\x34\x12\x78\x56\x34\x12"))
17
19
  end
18
20
 
19
21
  it 'should make correct fmix for 64bit integer' do
20
- murmur.fmix(1717859169).should eq(0xbefb9076a3712207)
21
- murmur.fmix(12345678912345678).should eq(0x197ef59146f5221c)
22
+ murmur.fmix(1717859169).must_equal(0xbefb9076a3712207)
23
+ murmur.fmix(12345678912345678).must_equal(0x197ef59146f5221c)
22
24
  end
23
25
  end
24
26
 
25
27
  shared_examples_32 = proc do
26
28
  it 'should make correct hash for string' do
27
- murmur.str_hash('asdfqwer', 0).should eq(0xa46b5209)
28
- murmur.str_hash('asdfqwerty', 0).should eq(0xa3cfe04b)
29
- murmur.str_hash('asd', 0).should eq(0x14570c6f)
29
+ murmur.str_hash('asdfqwer', 0).must_equal(0xa46b5209)
30
+ murmur.str_hash('asdfqwerty', 0).must_equal(0xa3cfe04b)
31
+ murmur.str_hash('asd', 0).must_equal(0x14570c6f)
30
32
  end
31
33
 
32
34
  it 'should make correct hash for 32bit integer' do
33
- murmur.int32_hash(1717859169).should eq(0x1b20e026)
34
- murmur.int32_hash(1717859169).should eq(murmur.str_hash('asdf'))
35
+ murmur.int32_hash(1717859169).must_equal(0x1b20e026)
36
+ murmur.int32_hash(1717859169).must_equal(murmur.str_hash('asdf'))
35
37
  end
36
38
 
37
39
  it 'should make correct hash for 64bit integer' do
38
- murmur.int64_hash(0x12345678).should eq(murmur.str_hash("\x78\x56\x34\x12\x00\x00\x00\x00"))
39
- murmur.int64_hash(0x1234567812345678).should eq(murmur.str_hash("\x78\x56\x34\x12\x78\x56\x34\x12"))
40
+ murmur.int64_hash(0x12345678).must_equal(murmur.str_hash("\x78\x56\x34\x12\x00\x00\x00\x00"))
41
+ murmur.int64_hash(0x1234567812345678).must_equal(murmur.str_hash("\x78\x56\x34\x12\x78\x56\x34\x12"))
40
42
  end
41
43
 
42
44
  it 'should make correct fmix for 32bit integer' do
43
- murmur.fmix(1717859169).should eq(0x17561734)
45
+ murmur.fmix(1717859169).must_equal(0x17561734)
44
46
  end
45
47
  end
46
48
 
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require_relative '../minitest_helper.rb'
2
2
 
3
3
  describe MurmurRedux::Hash do
4
4
  let(:string_to_digest) { 'Hello, world!' }
@@ -6,6 +6,6 @@ describe MurmurRedux::Hash do
6
6
  it 'digests an argument supplied string into a hexadecimal representation' do
7
7
  digested_string = MurmurRedux::Hash.digest(string_to_digest)
8
8
 
9
- expect(digested_string).to eq('df65d6d2d12d51f164c5f3a85066322c')
9
+ digested_string.must_equal 'df65d6d2d12d51f164c5f3a85066322c'
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: murmur_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marian Posaceanu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-21 00:00:00.000000000 Z
11
+ date: 2013-10-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple wrapper around murmurhash3 C extension originally based on https://github.com/funny-falcon/murmurhash3-ruby
14
14
  email: contact@marianposaceanu.com
@@ -18,11 +18,9 @@ extensions:
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - .gitignore
21
- - .rspec
22
21
  - .ruby-gemset
23
22
  - .ruby-version
24
23
  - Gemfile
25
- - Guardfile
26
24
  - README.md
27
25
  - Rakefile
28
26
  - ext/murmur_native/extconf.rb
@@ -32,9 +30,9 @@ files:
32
30
  - lib/murmur_redux/hash.rb
33
31
  - lib/murmur_redux/version.rb
34
32
  - murmur_redux.gemspec
33
+ - spec/minitest_helper.rb
35
34
  - spec/murmur_native_spec.rb
36
35
  - spec/murmur_redux/hash_spec.rb
37
- - spec/spec_helper.rb
38
36
  homepage: https://github.com/dakull/murmur_redux
39
37
  licenses:
40
38
  - MIT
@@ -56,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
54
  version: '0'
57
55
  requirements: []
58
56
  rubyforge_project:
59
- rubygems_version: 2.0.3
57
+ rubygems_version: 2.0.0
60
58
  signing_key:
61
59
  specification_version: 4
62
60
  summary: A simple wrapper around murmurhash3 C extension.
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format progress
data/Guardfile DELETED
@@ -1,24 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
-
9
- # Rails example
10
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
- watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
- watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
- watch('config/routes.rb') { "spec/routing" }
15
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
-
17
- # Capybara features specs
18
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
-
20
- # Turnip features and steps
21
- watch(%r{^spec/acceptance/(.+)\.feature$})
22
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
- end
24
-
@@ -1,9 +0,0 @@
1
- require 'murmur_redux'
2
-
3
- RSpec.configure do |config|
4
- config.treat_symbols_as_metadata_keys_with_true_values = true
5
- config.run_all_when_everything_filtered = true
6
- config.filter_run :focus
7
-
8
- config.order = 'random'
9
- end