Skip to content
This repository
  • 3 commits
  • 12 files changed
  • 0 comments
  • 1 contributor
12  Gemfile
... ...
@@ -1,8 +1,8 @@
1 1
 source :gemcutter
2 2
 
3  
-gem 'rake',       '>= 0.8.7'
4  
-gem 'rspec',      '>= 1.3.0'
5  
-gem 'rcov',       '>= 0.9.9'
6  
-gem 'yard',       '>= 0.5.4'
7  
-gem 'yard-rspec', '>= 0.1.0'
8  
-gem 'bluecloth',  '>= 2.0.5'
  3
+gem 'rake'
  4
+gem 'rspec'
  5
+gem 'simplecov'
  6
+gem 'yard'
  7
+gem 'yard-rspec'
  8
+gem 'bluecloth'
34  Gemfile.lock
... ...
@@ -1,11 +1,23 @@
1 1
 GEM
2 2
   remote: http://rubygems.org/
3 3
   specs:
4  
-    bluecloth (2.0.7)
5  
-    rake (0.8.7)
6  
-    rcov (0.9.9)
7  
-    rspec (1.3.0)
8  
-    yard (0.5.8)
  4
+    bluecloth (2.2.0)
  5
+    diff-lcs (1.1.3)
  6
+    multi_json (1.3.6)
  7
+    rake (0.9.2.2)
  8
+    rspec (2.11.0)
  9
+      rspec-core (~> 2.11.0)
  10
+      rspec-expectations (~> 2.11.0)
  11
+      rspec-mocks (~> 2.11.0)
  12
+    rspec-core (2.11.1)
  13
+    rspec-expectations (2.11.2)
  14
+      diff-lcs (~> 1.1.3)
  15
+    rspec-mocks (2.11.2)
  16
+    simplecov (0.6.4)
  17
+      multi_json (~> 1.0)
  18
+      simplecov-html (~> 0.5.3)
  19
+    simplecov-html (0.5.3)
  20
+    yard (0.8.2.1)
9 21
     yard-rspec (0.1)
10 22
       yard
11 23
 
@@ -13,9 +25,9 @@ PLATFORMS
13 25
   ruby
14 26
 
15 27
 DEPENDENCIES
16  
-  bluecloth (>= 2.0.5)
17  
-  rake (>= 0.8.7)
18  
-  rcov (>= 0.9.9)
19  
-  rspec (>= 1.3.0)
20  
-  yard (>= 0.5.4)
21  
-  yard-rspec (>= 0.1.0)
  28
+  bluecloth
  29
+  rake
  30
+  rspec
  31
+  simplecov
  32
+  yard
  33
+  yard-rspec
8  Rakefile
@@ -5,17 +5,13 @@ require 'bundler'
5 5
 Bundler.setup
6 6
 Bundler.require
7 7
 
8  
-require 'spec/rake/spectask'
  8
+require "rspec/core/rake_task"
9 9
 
10 10
 desc 'Default: run specs.'
11 11
 task :default => :spec
12 12
 
13 13
 desc 'Run the specs'
14  
-Spec::Rake::SpecTask.new(:spec) do |t|
15  
-  t.rcov_opts  << '--exclude "gems/*,spec/*"'
16  
-  t.rcov       = true
17  
-  t.rcov_dir   = 'doc/coverage'
18  
-  t.spec_files = FileList['spec/**/*_spec.rb']
  14
+RSpec::Core::RakeTask.new(:spec) do |t|
19 15
 end
20 16
 
21 17
 YARD::Rake::YardocTask.new(:doc) do |t|
48  spec/saulabs/gauss/distribution_spec.rb
@@ -32,19 +32,19 @@
32 32
   end
33 33
 
34 34
   it "should have a default deviation of 8.333333" do
35  
-    @dist.deviation.should be_close(8.333333, 0.000001)
  35
+    @dist.deviation.should be_within(0.000001).of(8.333333)
36 36
   end
37 37
 
38 38
   it "should set the variance to 69.444438" do
39  
-    @dist.variance.should be_close(69.4444, 0.0001)
  39
+    @dist.variance.should be_within(0.0001).of(69.4444)
40 40
   end
41 41
 
42 42
   it "should set the precision to 0.0144" do
43  
-    @dist.precision.should be_close(0.0144, 0.0001)
  43
+    @dist.precision.should be_within(0.0001).of(0.0144)
44 44
   end
45 45
 
46 46
   it "should set the precision_mean to 0.36" do
47  
-    @dist.precision_mean.should be_close(0.36, 0.0001)
  47
+    @dist.precision_mean.should be_within(0.0001).of(0.36)
48 48
   end
49 49
   
50 50
 end
@@ -60,19 +60,19 @@
60 60
   end
61 61
 
62 62
   it "should have a default deviation of 8.333333" do
63  
-    @dist.deviation.should be_close(8.333333, 0.000001)
  63
+    @dist.deviation.should be_within(0.000001).of(8.333333)
64 64
   end
65 65
 
66 66
   it "should set the variance to 69.444438" do
67  
-    @dist.variance.should be_close(69.4444, 0.0001)
  67
+    @dist.variance.should be_within(0.0001).of(69.4444)
68 68
   end
69 69
 
70 70
   it "should set the precision to 0.0144" do
71  
-    @dist.precision.should be_close(0.0144, 0.0001)
  71
+    @dist.precision.should be_within(0.0001).of(0.0144)
72 72
   end
73 73
 
74 74
   it "should set the precision_mean to 0.36" do
75  
-    @dist.precision_mean.should be_close(0.36, 0.0001)
  75
+    @dist.precision_mean.should be_within(0.0001).of(0.36)
76 76
   end
77 77
   
78 78
 end
@@ -92,7 +92,7 @@
92 92
   end
93 93
   
94 94
   it "should be 130.399408 for (22, 0.4) - (12, 1.3)" do
95  
-    (Gauss::Distribution.new(22, 0.4) - Gauss::Distribution.new(12, 1.3)).should be_close(130.399408, tolerance)
  95
+    (Gauss::Distribution.new(22, 0.4) - Gauss::Distribution.new(12, 1.3)).should be_within(tolerance).of(130.399408)
96 96
   end
97 97
   
98 98
 end
@@ -100,7 +100,7 @@
100 100
 describe Gauss::Distribution, "#value_at" do
101 101
   
102 102
   it "should have a value of 0.073654 for x = 2" do
103  
-    Gauss::Distribution.new(4,5).value_at(2).should be_close(0.073654, tolerance)
  103
+    Gauss::Distribution.new(4,5).value_at(2).should be_within(tolerance).of(0.073654)
104 104
   end
105 105
   
106 106
 end
@@ -108,11 +108,11 @@
108 108
 describe Gauss::Distribution, "multiplication (*)" do
109 109
   
110 110
   it "should have a mean of 0.2" do
111  
-    (Gauss::Distribution.new(0,1) * Gauss::Distribution.new(2,3)).mean.should be_close(0.2, 0.00001)
  111
+    (Gauss::Distribution.new(0,1) * Gauss::Distribution.new(2,3)).mean.should be_within(0.00001).of(0.2)
112 112
   end
113 113
   
114 114
   it "should have a deviation of 3.0 / Math.sqrt(10)" do
115  
-    (Gauss::Distribution.new(0,1) * Gauss::Distribution.new(2,3)).deviation.should be_close(3.0 / Math.sqrt(10), 0.00001)
  115
+    (Gauss::Distribution.new(0,1) * Gauss::Distribution.new(2,3)).deviation.should be_within(0.00001).of(3.0 / Math.sqrt(10))
116 116
   end
117 117
   
118 118
 end
@@ -121,7 +121,7 @@
121 121
   
122 122
   it "should have calculate -3.0979981" do
123 123
     lp = Gauss::Distribution.log_product_normalization(Gauss::Distribution.new(4,5), Gauss::Distribution.new(6,7))
124  
-    lp.should be_close(-3.0979981, 0.000001)
  124
+    lp.should be_within(0.000001).of(-3.0979981)
125 125
   end
126 126
   
127 127
 end
@@ -131,44 +131,44 @@
131 131
   describe 'value = 0.27' do
132 132
     
133 133
     it "#cumulative_distribution_function should return 0.6064198 for 0.27" do
134  
-      Gauss::Distribution.cumulative_distribution_function(0.27).should be_close(0.6064198, 0.00001)
135  
-      Gauss::Distribution.cdf(2.0).should be_close(0.9772498, 0.00001)
  134
+      Gauss::Distribution.cumulative_distribution_function(0.27).should be_within(0.00001).of(0.6064198)
  135
+      Gauss::Distribution.cdf(2.0).should be_within(0.00001).of(0.9772498)
136 136
     end
137 137
     
138 138
     it "#probability_density_function should return 0.384662" do
139  
-      Gauss::Distribution.probability_density_function(0.27).should be_close(0.384662, 0.0001)
  139
+      Gauss::Distribution.probability_density_function(0.27).should be_within(0.0001).of(0.384662)
140 140
     end
141 141
     
142 142
     it "#quantile_function should return ~ -0.6128123 at 0.27" do
143  
-      Gauss::Distribution.quantile_function(0.27).should be_close(-0.6128123, 0.00001)
  143
+      Gauss::Distribution.quantile_function(0.27).should be_within(0.00001).of(-0.6128123)
144 144
     end
145 145
     
146 146
     it "#quantile_function should return ~ 1.281551 at 0.9" do
147  
-      Gauss::Distribution.quantile_function(0.9).should be_close(1.281551, 0.00001)
  147
+      Gauss::Distribution.quantile_function(0.9).should be_within(0.00001).of(1.281551)
148 148
     end
149 149
     
150 150
     it "#erf_inv should return 0.0888559 at 0.9" do
151  
-      Gauss::Distribution.inv_erf(0.9).should be_close(0.0888559, 0.00001)
  151
+      Gauss::Distribution.inv_erf(0.9).should be_within(0.00001).of(0.0888559)
152 152
     end
153 153
     
154 154
     it "#erf_inv should return 0.779983 at 0.27" do
155  
-      Gauss::Distribution.inv_erf(0.27).should be_close(0.779983, 0.00001)
  155
+      Gauss::Distribution.inv_erf(0.27).should be_within(0.00001).of(0.779983)
156 156
     end
157 157
     
158 158
     it "#erf_inv should return 100 at -0.5" do
159  
-      Gauss::Distribution.inv_erf(-0.5).should be_close(100, 0.00001)
  159
+      Gauss::Distribution.inv_erf(-0.5).should be_within(0.00001).of(100)
160 160
     end
161 161
     
162 162
     it "#erf should return 0.203091 at 0.9" do
163  
-      Gauss::Distribution.erf(0.9).should be_close(0.203091, 0.00001)
  163
+      Gauss::Distribution.erf(0.9).should be_within(0.00001).of(0.203091)
164 164
     end
165 165
     
166 166
     it "#erf should return 0.702581 at 0.27" do
167  
-      Gauss::Distribution.erf(0.27).should be_close(0.702581, 0.00001)
  167
+      Gauss::Distribution.erf(0.27).should be_within(0.00001).of(0.702581)
168 168
     end
169 169
     
170 170
     it "#erf should return 1.520499 at -0.5" do
171  
-      Gauss::Distribution.erf(-0.5).should be_close(1.520499, 0.00001)
  171
+      Gauss::Distribution.erf(-0.5).should be_within(0.00001).of(1.520499)
172 172
     end
173 173
     
174 174
   end
20  spec/saulabs/gauss/truncated_correction_spec.rb
@@ -6,8 +6,8 @@
6 6
   describe "#w_within_margin" do
7 7
 
8 8
     it "should return 0.970397 for (0.2, 0.3)" do
9  
-      Gauss::TruncatedCorrection.w_within_margin(0.2, 0.3).should be_close(0.970397, tolerance)
10  
-      Gauss::TruncatedCorrection.w_within_margin(0.1, 0.03).should be_close(0.9997, tolerance)
  9
+      Gauss::TruncatedCorrection.w_within_margin(0.2, 0.3).should be_within(tolerance).of(0.970397)
  10
+      Gauss::TruncatedCorrection.w_within_margin(0.1, 0.03).should be_within(tolerance).of(0.9997)
11 11
     end
12 12
 
13 13
   end
@@ -15,8 +15,8 @@
15 15
   describe "#v_within_margin" do
16 16
 
17 17
     it "should return -0.194073 for (0.2, 0.3)" do
18  
-      Gauss::TruncatedCorrection.v_within_margin(0.2, 0.3).should be_close(-0.194073, tolerance)
19  
-      Gauss::TruncatedCorrection.v_within_margin(0.1, 0.03).should be_close(-0.09997, tolerance)
  18
+      Gauss::TruncatedCorrection.v_within_margin(0.2, 0.3).should be_within(tolerance).of(-0.194073)
  19
+      Gauss::TruncatedCorrection.v_within_margin(0.1, 0.03).should be_within(tolerance).of(-0.09997)
20 20
     end
21 21
 
22 22
   end
@@ -24,9 +24,9 @@
24 24
   describe "#w_exceeds_margin" do
25 25
   
26 26
     it "should return 0.657847 for (0.2, 0.3)" do
27  
-      Gauss::TruncatedCorrection.w_exceeds_margin(0.0, 0.740466).should be_close(0.76774506, tolerance)
28  
-      Gauss::TruncatedCorrection.w_exceeds_margin(0.2, 0.3).should be_close(0.657847, tolerance)
29  
-      Gauss::TruncatedCorrection.w_exceeds_margin(0.1, 0.03).should be_close(0.621078, tolerance)
  27
+      Gauss::TruncatedCorrection.w_exceeds_margin(0.0, 0.740466).should be_within(tolerance).of(0.76774506)
  28
+      Gauss::TruncatedCorrection.w_exceeds_margin(0.2, 0.3).should be_within(tolerance).of(0.657847)
  29
+      Gauss::TruncatedCorrection.w_exceeds_margin(0.1, 0.03).should be_within(tolerance).of(0.621078)
30 30
     end
31 31
   
32 32
   end
@@ -34,9 +34,9 @@
34 34
   describe "#v_exceeds_margin" do
35 35
   
36 36
     it "should return 0.8626174 for (0.2, 0.3)" do
37  
-      Gauss::TruncatedCorrection.v_exceeds_margin(0.0, 0.740466).should be_close(1.32145197, tolerance)
38  
-      Gauss::TruncatedCorrection.v_exceeds_margin(0.2, 0.3).should be_close(0.8626174, tolerance)
39  
-      Gauss::TruncatedCorrection.v_exceeds_margin(0.1, 0.03).should be_close(0.753861, tolerance)
  37
+      Gauss::TruncatedCorrection.v_exceeds_margin(0.0, 0.740466).should be_within(tolerance).of(1.32145197)
  38
+      Gauss::TruncatedCorrection.v_exceeds_margin(0.2, 0.3).should be_within(tolerance).of(0.8626174)
  39
+      Gauss::TruncatedCorrection.v_exceeds_margin(0.1, 0.03).should be_within(tolerance).of(0.753861)
40 40
     end
41 41
   
42 42
   end
6  spec/saulabs/trueskill/factor_graph_spec.rb
@@ -13,12 +13,12 @@
13 13
     
14 14
     it "should update the mean of the first player in team1 to 30.38345" do
15 15
       @graph.update_skills
16  
-      @skill.mean.should be_close(30.38345, tolerance)
  16
+      @skill.mean.should be_within(tolerance).of(30.38345)
17 17
     end
18 18
     
19 19
     it "should update the deviation of the first player in team1 to 3.46421" do
20 20
       @graph.update_skills
21  
-      @skill.deviation.should be_close(3.46421, tolerance)
  21
+      @skill.deviation.should be_within(tolerance).of(3.46421)
22 22
     end
23 23
     
24 24
   end
@@ -26,7 +26,7 @@
26 26
   describe "#draw_margin" do
27 27
     
28 28
     it "should be -0.998291 for diff 0.740466" do
29  
-      @graph.draw_margin.should be_close(0.740466, tolerance)
  29
+      @graph.draw_margin.should be_within(tolerance).of(0.740466)
30 30
     end
31 31
     
32 32
   end
4  spec/saulabs/trueskill/factors/greater_than_spec.rb
@@ -11,7 +11,7 @@
11 11
   describe "#update_message_at" do
12 12
     
13 13
     it "should return a difference of 2.1409" do
14  
-      @factor.update_message_at(0).should be_close(2.1409, tolerance)
  14
+      @factor.update_message_at(0).should be_within(tolerance).of(2.1409)
15 15
     end
16 16
   
17 17
   end
@@ -19,7 +19,7 @@
19 19
   describe "#log_normalization" do
20 20
     
21 21
     it "should be -0.69314" do
22  
-      @factor.log_normalization.should be_close(-0.69314, tolerance)
  22
+      @factor.log_normalization.should be_within(tolerance).of(-0.69314)
23 23
     end
24 24
   
25 25
   end
4  spec/saulabs/trueskill/factors/likelihood_spec.rb
@@ -12,12 +12,12 @@
12 12
   describe "#update_message_at" do
13 13
     
14 14
     it "should return a difference of 0.0" do
15  
-      @factor.update_message_at(0).should be_close(0.0, tolerance)
  15
+      @factor.update_message_at(0).should be_within(tolerance).of(0.0)
16 16
     end
17 17
     
18 18
     it "should return a difference of 0.833066 for the second message" do
19 19
       @factor.update_message_at(0)
20  
-      @factor.update_message_at(1).should be_close(0.833066, tolerance)
  20
+      @factor.update_message_at(1).should be_within(tolerance).of(0.833066)
21 21
     end
22 22
   
23 23
   end
2  spec/saulabs/trueskill/factors/prior_spec.rb
@@ -11,7 +11,7 @@
11 11
   describe "#update_message_at" do
12 12
     
13 13
     it "should return a difference of 73.33333" do
14  
-      @factor.update_message_at(0).should be_close(73.33333, tolerance)
  14
+      @factor.update_message_at(0).should be_within(tolerance).of(73.33333)
15 15
     end
16 16
   
17 17
   end
26  spec/saulabs/trueskill/factors/weighted_sum_spec.rb
@@ -16,12 +16,12 @@
16 16
   describe "weights" do
17 17
     
18 18
     it "should setup the weights correctly" do
19  
-      @factor.weights[0][0].should be_close(0.5, tolerance)
20  
-      @factor.weights[1][0].should be_close(-1.4, tolerance)
21  
-      @factor.weights[2][0].should be_close(-0.7142, tolerance)
22  
-      @factor.weights[2][1].should be_close(-1.14285, tolerance)
23  
-      @factor.weights[3][0].should be_close(-0.625, tolerance)
24  
-      @factor.weights[3][2].should be_close(1.25, tolerance)
  19
+      @factor.weights[0][0].should be_within(tolerance).of(0.5)
  20
+      @factor.weights[1][0].should be_within(tolerance).of(-1.4)
  21
+      @factor.weights[2][0].should be_within(tolerance).of(-0.7142)
  22
+      @factor.weights[2][1].should be_within(tolerance).of(-1.14285)
  23
+      @factor.weights[3][0].should be_within(tolerance).of(-0.625)
  24
+      @factor.weights[3][2].should be_within(tolerance).of(1.25)
25 25
     end
26 26
     
27 27
   end
@@ -29,12 +29,12 @@
29 29
   describe "weights_squared" do
30 30
     
31 31
     it "should setup the squared weights correctly" do
32  
-      @factor.weights_squared[0][0].should be_close(0.25, tolerance)
33  
-      @factor.weights_squared[1][0].should be_close(1.96, tolerance)
34  
-      @factor.weights_squared[2][0].should be_close(0.51, tolerance)
35  
-      @factor.weights_squared[2][1].should be_close(1.3061, tolerance)
36  
-      @factor.weights_squared[3][0].should be_close(0.3906, tolerance)
37  
-      @factor.weights_squared[3][2].should be_close(1.5625, tolerance)
  32
+      @factor.weights_squared[0][0].should be_within(tolerance).of(0.25)
  33
+      @factor.weights_squared[1][0].should be_within(tolerance).of(1.96)
  34
+      @factor.weights_squared[2][0].should be_within(tolerance).of(0.51)
  35
+      @factor.weights_squared[2][1].should be_within(tolerance).of(1.3061)
  36
+      @factor.weights_squared[3][0].should be_within(tolerance).of(0.3906)
  37
+      @factor.weights_squared[3][2].should be_within(tolerance).of(1.5625)
38 38
     end
39 39
     
40 40
   end
@@ -55,7 +55,7 @@
55 55
   describe "#update_message_at" do
56 56
     
57 57
     it "should return a difference of 4.50116 for message 0" do
58  
-      @factor.update_message_at(0).should be_close(4.50116, tolerance)
  58
+      @factor.update_message_at(0).should be_within(tolerance).of(4.50116)
59 59
     end
60 60
   
61 61
   end
4  spec/saulabs/trueskill/factors/within_spec.rb
@@ -11,7 +11,7 @@
11 11
   describe "#update_message_at" do
12 12
     
13 13
     it "should return a difference of 173.2048" do
14  
-      @factor.update_message_at(0).should be_close(173.2048, tolerance)
  14
+      @factor.update_message_at(0).should be_within(tolerance).of(173.2048)
15 15
     end
16 16
   
17 17
   end
@@ -19,7 +19,7 @@
19 19
   describe "#log_normalization" do
20 20
     
21 21
     it "should be -5.339497" do
22  
-      @factor.log_normalization.should be_close(-5.339497, tolerance)
  22
+      @factor.log_normalization.should be_within(tolerance).of(-5.339497)
23 23
     end
24 24
   
25 25
   end
5  spec/spec_helper.rb
... ...
@@ -1,13 +1,12 @@
1 1
 # -*- encoding : utf-8 -*-
2 2
 require 'rubygems'
3  
-require 'spec'
4  
-require 'spec/autorun'
  3
+require 'rspec'
5 4
 require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "saulabs", "trueskill.rb"))
6 5
 require File.expand_path(File.join(File.dirname(__FILE__), "true_skill_matchers.rb"))
7 6
 
8 7
 include Saulabs
9 8
 
10  
-Spec::Runner.configure do |config|
  9
+RSpec.configure do |config|
11 10
   config.include(TrueSkillMatchers)
12 11
 end
13 12
 

No commit comments for this range

Something went wrong with that request. Please try again.