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.
- data/lib/sumbur/sumbur.jar +0 -0
- data/lib/sumbur/version.rb +1 -1
- data/test/test_sumbur.rb +7 -7
- metadata +1 -1
data/lib/sumbur/sumbur.jar
CHANGED
Binary file
|
data/lib/sumbur/version.rb
CHANGED
data/test/test_sumbur.rb
CHANGED
@@ -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)),
|
45
|
+
mvd.must_be_within_epsilon (num/capa - num/(capa+1)), eps
|
46
46
|
end
|
47
|
-
moved.must_be_within_epsilon num/(capa+1),
|
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
|
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
|
82
|
+
end
|
83
83
|
end
|
84
84
|
rescue LoadError
|
85
85
|
puts "Native version is not tested"
|