sumbur 0.1.0-jruby → 0.1.1-jruby

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -1,3 +1,3 @@
1
1
  module Sumbur
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -3,7 +3,7 @@ require 'minitest/autorun'
3
3
 
4
4
  $spread_cache = {}
5
5
 
6
- HASHED = (1..1_000_000).map{|i|
6
+ HASHED = (1..1_000_000).map{|i|
7
7
  h = i ^ (i >> 16)
8
8
  h = (h * 0x85ebca6b) & 0xFFffFFff
9
9
  h ^= h >> 13
@@ -34,7 +34,7 @@ shared_example = proc do
34
34
  end
35
35
 
36
36
  it "should reshard values cleanly" do
37
- for num in [100_000, 1_000_000]
37
+ for num, eps in [[100_000, 0.2], [1_000_000, 0.05]]
38
38
  for capa in [2,3,7,8,17,18]
39
39
  cur = spread(num, capa, sumbur)
40
40
  nxt = spread(num, capa+1, sumbur)
@@ -42,9 +42,9 @@ shared_example = proc do
42
42
  for i in 0...capa
43
43
  (nxt[i] - cur[i]).must_be_empty
44
44
  moved += mvd = (cur[i] - nxt[i]).size
45
- mvd.must_be_within_epsilon (num/capa - num/(capa+1)), 40000.0/num
45
+ mvd.must_be_within_epsilon (num/capa - num/(capa+1)), eps
46
46
  end
47
- moved.must_be_within_epsilon num/(capa+1), 7000.0/num
47
+ moved.must_be_within_epsilon num/(capa+1), eps
48
48
  end
49
49
  end
50
50
  end
@@ -56,7 +56,7 @@ describe "Pure Ruby" do
56
56
  Sumbur::PureRuby
57
57
  end
58
58
  class_exec &shared_example
59
- end if false
59
+ end
60
60
 
61
61
  begin
62
62
  if RUBY_ENGINE == 'jruby'
@@ -76,10 +76,10 @@ begin
76
76
  class_exec &shared_example
77
77
 
78
78
  it "should produce same spread as pure ruby version" do
79
- for capa in [2,3,4,7,8,9,17,18,19]
79
+ for capa in [2,3,4,7,8,9,17,18,19,100]
80
80
  spread(1_000_000, capa, sumbur).must_equal spread(1_000_000, capa, Sumbur::PureRuby)
81
81
  end
82
- end if false
82
+ end
83
83
  end
84
84
  rescue LoadError
85
85
  puts "Native version is not tested"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sumbur
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: jruby
7
7
  authors:
8
8
  - Sokolov Yura 'funny-falcon'