bullshit 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  module Bullshit
2
2
  # Bullshit version
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullshit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Florian Frank
@@ -9,51 +15,103 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-11-18 00:00:00 +01:00
18
+ date: 2011-07-17 00:00:00 +02:00
13
19
  default_executable:
14
20
  dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: gem_hadar
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 0
32
+ - 0
33
+ - 5
34
+ version: 0.0.5
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: spruz
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 0
48
+ - 2
49
+ version: "0.2"
50
+ type: :runtime
51
+ version_requirements: *id002
15
52
  - !ruby/object:Gem::Dependency
16
53
  name: dslkit
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 15
61
+ segments:
62
+ - 0
63
+ - 2
64
+ version: "0.2"
17
65
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: more_math
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
20
72
  requirements:
21
- - - ">="
73
+ - - ~>
22
74
  - !ruby/object:Gem::Version
23
- version: 0.2.5
24
- version:
25
- description: ""
75
+ hash: 29
76
+ segments:
77
+ - 0
78
+ - 0
79
+ - 1
80
+ version: 0.0.1
81
+ type: :runtime
82
+ version_requirements: *id004
83
+ description: Library to benchmark ruby code and analyse the results
26
84
  email: flori@ping.de
27
85
  executables:
28
86
  - bs_compare
29
87
  extensions: []
30
88
 
31
- extra_rdoc_files: []
32
-
89
+ extra_rdoc_files:
90
+ - README.rdoc
91
+ - lib/bullshit/version.rb
92
+ - lib/bullshit.rb
33
93
  files:
94
+ - .gitignore
95
+ - .travis.yml
34
96
  - CHANGES
35
- - bin/bs_compare
36
- - VERSION
37
- - README
38
- - make_doc.rb
97
+ - COPYING
98
+ - Gemfile
99
+ - README.rdoc
39
100
  - Rakefile
40
- - examples/throw_raise.rb
101
+ - VERSION
102
+ - bin/bs_compare
103
+ - bullshit.gemspec
104
+ - data/.keep
105
+ - examples/compare.rb
106
+ - examples/fibonacci.rb
41
107
  - examples/iteration.rb
42
108
  - examples/josephus.rb
43
- - examples/fibonacci.rb
44
- - examples/compare.rb
45
109
  - examples/sorting.rb
46
- - lib/bullshit/version.rb
110
+ - examples/throw_raise.rb
47
111
  - lib/bullshit.rb
48
- - tests/test_continued_fraction.rb
49
- - tests/test_window.rb
50
- - tests/test_functions.rb
51
- - tests/test_analysis.rb
112
+ - lib/bullshit/version.rb
52
113
  - tests/test_bullshit.rb
53
- - tests/test_distribution.rb
54
- - tests/test_newton_bisection.rb
55
- - COPYING
56
- - install.rb
114
+ - tests/test_window.rb
57
115
  has_rdoc: true
58
116
  homepage: http://flori.github.com/bullshit
59
117
  licenses: []
@@ -63,33 +121,34 @@ rdoc_options:
63
121
  - --title
64
122
  - Bullshit -- Benchmarking in Ruby
65
123
  - --main
66
- - README
124
+ - README.rdoc
67
125
  require_paths:
68
126
  - lib
69
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
70
129
  requirements:
71
130
  - - ">="
72
131
  - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
73
135
  version: "0"
74
- version:
75
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
76
138
  requirements:
77
139
  - - ">="
78
140
  - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
79
144
  version: "0"
80
- version:
81
145
  requirements: []
82
146
 
83
- rubyforge_project: bullshit
84
- rubygems_version: 1.3.5
147
+ rubyforge_project:
148
+ rubygems_version: 1.6.2
85
149
  signing_key:
86
150
  specification_version: 3
87
151
  summary: Benchmarking is Bullshit
88
152
  test_files:
89
- - tests/test_continued_fraction.rb
90
- - tests/test_window.rb
91
- - tests/test_functions.rb
92
- - tests/test_analysis.rb
93
153
  - tests/test_bullshit.rb
94
- - tests/test_distribution.rb
95
- - tests/test_newton_bisection.rb
154
+ - tests/test_window.rb
data/install.rb DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rbconfig'
4
- require 'fileutils'
5
- include FileUtils::Verbose
6
-
7
- include Config
8
-
9
- file = 'lib/bullshit.rb'
10
- libdir = CONFIG["sitelibdir"]
11
- install(file, libdir, :mode => 0755)
12
- mkdir_p subdir = File.join(libdir, 'bullshit')
13
- for f in Dir['lib/bullshit/*.rb']
14
- install(f, subdir)
15
- end
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts "Creating documentation."
4
- system "rdoc --main README --title 'Bullshit -- Benchmarking in Ruby'"\
5
- " -d #{Dir['lib/**/*.rb'] * ' '}"
@@ -1,321 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'test/unit'
4
- require 'bullshit'
5
-
6
- class TestAnalysis < Test::Unit::TestCase
7
- include Bullshit
8
-
9
- def setup
10
- @flat = Analysis.new([0.3] * 100)
11
- @flat_fuzzy = Analysis.new(
12
- [ 0.291296142070089, 0.398027886480809, 0.23101231921608,
13
- 0.340627534773153, 0.254242992113383, 0.205044980114447,
14
- 0.278185292370019, 0.291682510899134, 0.261657208149687,
15
- 0.259844137242866, 0.378499162508619, 0.229358104972725,
16
- 0.386112073235523, 0.235255070067096, 0.296721262492287,
17
- 0.314698077842112, 0.363272733105109, 0.252507159666997,
18
- 0.24662025484673, 0.267331187480918, 0.250067060724856,
19
- 0.284270210340375, 0.262626100532033, 0.352433737639362,
20
- 0.26289285183689, 0.320853587421585, 0.311156494750873,
21
- 0.334225510831559, 0.356205648289854, 0.390488123286748,
22
- 0.232295923957093, 0.306018392326888, 0.226951061989688,
23
- 0.214593004467917, 0.28960026747272, 0.265265575971784,
24
- 0.281799797229565, 0.337363136532618, 0.342475071004423,
25
- 0.284553882868128, 0.389206786931739, 0.351602477407745,
26
- 0.387218788482334, 0.251003385993573, 0.257866093151574,
27
- 0.328824195781741, 0.328242240833557, 0.318885903421821,
28
- 0.319274078029297, 0.29658003664557, 0.24884905382522,
29
- 0.301770636812583, 0.248911378817175, 0.275471776328434,
30
- 0.220091513752346, 0.283076025940448, 0.388218608044549,
31
- 0.283229339831472, 0.224570945957831, 0.362485839646397,
32
- 0.221550677368212, 0.269482540591461, 0.339070334243095,
33
- 0.325182999080969, 0.308728933369353, 0.3863941656383,
34
- 0.202792339314435, 0.362856265274183, 0.265505144702292,
35
- 0.353077334823915, 0.324128317440701, 0.296975637938554,
36
- 0.331591291884613, 0.205993447724166, 0.214480100701257,
37
- 0.344614724259284, 0.370516595329498, 0.207412716360969,
38
- 0.314721036012706, 0.228984115281106, 0.259032440399333,
39
- 0.326352618555389, 0.353756258146666, 0.230771059239658,
40
- 0.250581960820831, 0.21462520718052, 0.241570172219703,
41
- 0.296495456059297, 0.336874993277199, 0.399203721142938,
42
- 0.330151086176299, 0.327699314698143, 0.235627029696985,
43
- 0.325564466304218, 0.398295977228244, 0.33192554316584,
44
- 0.22526704197204, 0.342117813790757, 0.32678523559579,
45
- 0.214938036987578 ]
46
- )
47
- @flat_fuzzy2 = Analysis.new(
48
- [ 0.234651800685522, 0.291677132057536, 0.381325747665659,
49
- 0.37072453863211, 0.368865699927557, 0.35787506718781,
50
- 0.350720373167135, 0.258635475849321, 0.31707597552194,
51
- 0.307893709010183, 0.237849819950067, 0.315881610046543,
52
- 0.201585641064648, 0.344368312712124, 0.34501166666737,
53
- 0.294042914293632, 0.211771331394304, 0.363815509779845,
54
- 0.33673412152282, 0.37498088769697, 0.201244093764913,
55
- 0.236387765961558, 0.296850838293593, 0.223829530755105,
56
- 0.213694650150962, 0.227416795706971, 0.200625724917622,
57
- 0.31227957802719, 0.385983037604518, 0.287242927867868,
58
- 0.258470258047964, 0.344169516126964, 0.26994416010751,
59
- 0.249768846393261, 0.354426097251265, 0.34021066927398,
60
- 0.307077285175548, 0.3497224779728, 0.254650791783532,
61
- 0.285180048375893, 0.201603698883297, 0.314417350151038,
62
- 0.320909639401826, 0.287679809618447, 0.328814685203504,
63
- 0.370476190838299, 0.291359505243309, 0.273781936455096,
64
- 0.325113918862285, 0.367110740063297, 0.247073598694453,
65
- 0.350942986897521, 0.232261700593331, 0.236635735267053,
66
- 0.240796903369692, 0.323428956239516, 0.324614910738737,
67
- 0.237871567371432, 0.310816928958706, 0.264609945655404,
68
- 0.236819188672949, 0.28398352994042, 0.366840181124702,
69
- 0.339882426068036, 0.397478482750453, 0.379375601208701,
70
- 0.281206116730092, 0.203947998858132, 0.231558650797902,
71
- 0.380785793096893, 0.334270739370193, 0.266229655641688,
72
- 0.315762224650585, 0.243378114262551, 0.294001949668671,
73
- 0.247508966656796, 0.382845661950797, 0.369479413879656,
74
- 0.241683415140724, 0.218541361179393, 0.319914186441019,
75
- 0.310250120051708, 0.234697684147101, 0.34734046492662,
76
- 0.218217334366937, 0.312537298293074, 0.374319776312122,
77
- 0.392178633368011, 0.314428694398314, 0.386204177791726,
78
- 0.359061970124816, 0.362334074442194, 0.229293408035385,
79
- 0.313763536361359, 0.239344793134688, 0.265237324138875,
80
- 0.329259743982286, 0.351767216150251, 0.211193779699827,
81
- 0.258235773260784 ]
82
- )
83
- @flat_higher = Analysis.new(
84
- [ 0.417776755544947, 0.326476805772892, 0.332887733006402,
85
- 0.410565271773857, 0.426114386030809, 0.435935520406595,
86
- 0.339995159533461, 0.364761157546518, 0.378397233333935,
87
- 0.35210733002035, 0.330688506187733, 0.492648864412129,
88
- 0.33833199089868, 0.42789271416588, 0.302423735510181,
89
- 0.305407403523733, 0.408725319360953, 0.444623946541953,
90
- 0.494162827022184, 0.386239353430498, 0.306437290600178,
91
- 0.376703331326491, 0.419906847790677, 0.301955977987602,
92
- 0.487468198801442, 0.312290516021979, 0.495906290662686,
93
- 0.303379939018008, 0.460384318463054, 0.473534870478338,
94
- 0.333912270251847, 0.460143618655486, 0.419257177279749,
95
- 0.355072829732943, 0.453419475031392, 0.468523177257953,
96
- 0.405173514106214, 0.490981451264441, 0.333761262319564,
97
- 0.405754543238307, 0.495673694657207, 0.302783349166472,
98
- 0.432418922874345, 0.329915804259514, 0.356588738342812,
99
- 0.354349707229742, 0.452693480248568, 0.474877692732008,
100
- 0.405383243600942, 0.402915847080871, 0.492915699075631,
101
- 0.462094206093751, 0.339883346924172, 0.451846443788079,
102
- 0.464163288957183, 0.405878012725365, 0.467568948869427,
103
- 0.419585038305752, 0.422900365624952, 0.494116259378179,
104
- 0.300073213028546, 0.474018244228735, 0.38822872923958,
105
- 0.441707083196939, 0.406814346112675, 0.403958151779294,
106
- 0.307247538830431, 0.409650643221185, 0.493148685003474,
107
- 0.36058138779566, 0.36321317486353, 0.393068747347969,
108
- 0.468879326612198, 0.425234138346863, 0.421949132207673,
109
- 0.306005645410334, 0.439055703332639, 0.317183300984821,
110
- 0.470848293063698, 0.440820107004846, 0.438285035336276,
111
- 0.434787376714648, 0.453596753001295, 0.399893734859051,
112
- 0.458116608707833, 0.330973155542121, 0.31666421784907,
113
- 0.467682075506155, 0.452806591013364, 0.379423936292945,
114
- 0.357212688143182, 0.385848611013958, 0.349586136874291,
115
- 0.46683976269393, 0.484776275752459, 0.30829081820033,
116
- 0.41637633029041, 0.350847171677106, 0.416615749876575,
117
- 0.382674729559805 ]
118
- )
119
- @half = Analysis.new(Array.new(100) { |i| 0.5 * i })
120
- @rand = Analysis.new(rand = [
121
- 97, 26, 9, 78, 15, 86, 82, 24, 57, 67, 46, 86, 28,
122
- 50, 71, 92, 18, 19, 16, 70, 80, 45, 26, 4, 16, 55, 15,
123
- 94, 12, 73, 89, 97, 10, 2, 77, 35, 76, 46, 48, 31, 39,
124
- 52, 82, 53, 88, 90, 1, 39, 77, 71, 37, 37, 50, 19, 60,
125
- 48, 0, 13, 62, 34, 90, 28, 42, 9, 63, 82, 43, 98, 86,
126
- 3, 94, 5, 79, 11, 16, 0, 90, 81, 42, 64, 76, 92, 25,
127
- 3, 90, 51, 15, 0, 74, 98, 93, 90, 14, 81, 85, 28, 30,
128
- 73, 32, 88])
129
- @rand_up = Analysis.new(Array.new(rand.size) { |i| rand[i] * (1 - 4.0 / (i + 1)) })
130
- @rand_down = Analysis.new(Array.new(rand.size) { |i| rand[i] * (1 + 4.0 / (i + 1)) })
131
- @rasi = Analysis.new(
132
- [ 0.0, 11.7813239550446, 23.8742291678261, 0.368124552684678,
133
- 20.233654312272, 7.64120827980215, 61.609239533582, 69.346191849821,
134
- 66.7019061146592, 26.2399845215146, 2.85316954888546, 29.4686175218607,
135
- 15.9684276548523, 15.9684276548523, 36.3446282769615, 66.5739561406607,
136
- 85.9585699842718, 75.9895132951814, 9.24615891330947, 7.53001816521557,
137
- 22.335839587114, 32.2774961648149, 31.2905869781976, 15.1700831170561,
138
- 6.1413284446509, -2.95898288510399e-14, -4.63732964187926,
139
- -2.2382089844837, -2.20874731610807, -0.0, -20.5724838302366,
140
- -60.2401453217246, -39.2961753815653, -59.9472827106431,
141
- -47.051006728233, -4.75528258147577, -20.6280322653025, -43.913176050844,
142
- -78.8441115458335, -30.4509047725893, -38.0422606518061,
143
- -77.8151265120777, -4.22163962751007, -32.3615561965831,
144
- -42.4419205675787, -40.5571824081806, -6.2627977633223,
145
- -5.52186829027017, -6.96331684061593, -10.4026583858372,
146
- 3.8595428936139e-15, 9.0239928166299, 12.9318741325725, 34.9718325050444,
147
- 46.7301063878664, 49.3739611925678, 58.1865040039386, 30.8205297110316,
148
- 36.3061007965867, 29.8592927313786, 88.4482560154493, 54.0257987900779,
149
- 16.9664543832806, 92.8164857438293, 62.8663840466361, 78.9376908524978,
150
- 41.6220444134369, 78.5224970716874, 35.4436091676863, 66.4010692750828,
151
- 14.6946313073118, 19.2701469640686, 31.6587115308823, 15.1700831170561,
152
- 1.25333233564304, 1.83690953073357e-15, -4.76266287544359,
153
- -17.6569819887047, -12.1481102385944, -39.5038012763407,
154
- -20.5724838302365, -28.0664313430763, -20.8038575549463,
155
- -10.1319351060242, -10.8579246295922, -33.2869780703304,
156
- -77.6006928075664, -21.956588025422, -44.9112027792722,
157
- -56.9726605422639, -19.0211303259031, -80.5296076694757,
158
- -15.1979026590363, -51.6243872659778, -45.1801089912934,
159
- -54.6640284631999, -17.3431322676617, -21.719348608396, -11.937114583913,
160
- -3.38399730623621 ]
161
- )
162
- @rasi_mean = Analysis.new([ 3.48 ] * 100)
163
- @book = Analysis.new(
164
- [ 47, 64, 23, 71, 38, 64, 55, 41, 59, 48, 71, 35, 57, 40, 58,
165
- 44, 89, 55, 37, 74, 51, 57, 50, 60, 45, 57, 50, 45, 25, 59,
166
- 50, 71, 56, 74, 50, 58, 45, 54, 36, 54, 48, 55, 45, 57, 50,
167
- 62, 44, 64, 43, 52, 38, 59, 55, 41, 53, 49, 34, 35, 54, 45,
168
- 68, 38, 50, 60, 39, 59, 40, 57, 54, 23 ]
169
- )
170
- end
171
-
172
- def test_flat
173
- assert_equal 100, @flat.size
174
- assert_in_delta 0.3, @flat.mean, 1E-8
175
- assert_in_delta 0.3, @flat.geometric_mean, 1E-8
176
- assert_in_delta 0.3, @flat.harmonic_mean, 1E-8
177
- assert_in_delta 0, @flat.variance, 1E-8
178
- assert_in_delta 0, @flat.standard_deviation, 1E-8
179
- assert_in_delta 0, @flat.sample_standard_deviation, 1E-8
180
- assert_in_delta 30, @flat.sum, 1E-8
181
- assert_in_delta 0.3, @flat.min, 1E-8
182
- assert_in_delta 0.3, @flat.max, 1E-8
183
- assert_in_delta 0.3, @flat.percentile(25), 1E-8
184
- assert_in_delta 0.3, @flat.median, 1E-8
185
- assert_in_delta 0.3, @flat.percentile(75), 1E-8
186
- assert_equal 100, @flat.histogram(10).to_a.first[1]
187
- end
188
-
189
- def test_half
190
- assert_equal 100, @half.size
191
- assert_in_delta 24.75, @half.mean, 1E-8
192
- assert_in_delta 0.0, @half.geometric_mean, 1E-8
193
- assert_equal 'NaN', @half.harmonic_mean.to_s
194
- assert_in_delta 208.31, @half.variance, 1E-2
195
- assert_in_delta 14.43, @half.standard_deviation, 1E-2
196
- assert_in_delta 14.50, @half.sample_standard_deviation, 1E-2
197
- assert_in_delta 2475, @half.sum, 1E-8
198
- assert_in_delta 0, @half.min, 1E-8
199
- assert_in_delta 99 / 2.0, @half.max, 1E-8
200
- assert_in_delta 12.125, @half.percentile(25), 1E-8
201
- assert_in_delta 24.75, @half.median, 1E-8
202
- assert_in_delta 37.375, @half.percentile(75), 1E-8
203
- assert_equal [10] * 10, counts = @half.histogram(10).to_a.transpose[1]
204
- assert_equal 100, counts.inject { |s, x| s + x }
205
- end
206
-
207
- def test_rand
208
- assert_equal 100, @rand.size
209
- assert_in_delta 50.84, @rand.mean, 1E-2
210
- assert_in_delta 0.0, @rand.geometric_mean, 1E-8
211
- assert_equal 'NaN', @rand.harmonic_mean.to_s
212
- assert_in_delta 976.95, @rand.variance, 1E-2
213
- assert_in_delta 31.25, @rand.standard_deviation, 1E-2
214
- assert_in_delta 31.41, @rand.sample_standard_deviation, 1E-2
215
- assert_in_delta 5084, @rand.sum, 1E-8
216
- assert_in_delta 0, @rand.min, 1E-8
217
- assert_in_delta 98, @rand.max, 1E-8
218
- assert_in_delta 20.25, @rand.percentile(25), 1E-8
219
- assert_in_delta 50.0, @rand.median, 1E-8
220
- assert_in_delta 81, @rand.percentile(75), 1E-8
221
- assert_in_delta 0.05660, @rand.linear_regression.a, 1E-4
222
- assert_in_delta 47.9812, @rand.linear_regression.b, 1E-4
223
- assert @rand.linear_regression.slope_zero?
224
- assert_in_delta(-0.4019, @rand_down.linear_regression.a, 1E-4)
225
- assert_in_delta 82.7303, @rand_down.linear_regression.b, 1E-4
226
- assert !@rand_down.linear_regression.slope_zero?
227
- assert_in_delta 0.5151, @rand_up.linear_regression.a, 1E-4
228
- assert_in_delta(13.2320, @rand_up.linear_regression.b, 1E-4)
229
- assert !@rand_up.linear_regression.slope_zero?
230
- assert_nil @rand.detect_outliers
231
- assert !@rand.detect_autocorrelation[:detected]
232
- assert_equal [11, 14, 7, 9, 8, 7, 5, 11, 13, 15],
233
- counts = @rand.histogram(10).to_a.transpose[1]
234
- assert_equal 100, counts.inject { |s, x| s + x }
235
- end
236
-
237
- def test_rasi
238
- assert_equal 100, @rasi.size
239
- assert_in_delta 3.48, @rasi.mean, 1E-2
240
- assert_in_delta 0.0, @rasi.geometric_mean, 1E-8
241
- assert_equal 'NaN', @rasi.harmonic_mean.to_s
242
- assert_in_delta 1604.67, @rasi.variance, 1E-2
243
- assert_in_delta 40.05, @rasi.standard_deviation, 1E-2
244
- assert_in_delta 40.26, @rasi.sample_standard_deviation, 1E-2
245
- assert_in_delta 348.007, @rasi.sum, 1E-3
246
- assert_in_delta 92.81, @rasi.max, 1E-2
247
- assert_in_delta(-20.75, @rasi.percentile(25), 1E-2)
248
- assert_in_delta 0.0, @rasi.median, 1E-2
249
- assert_in_delta 30.58, @rasi.percentile(75), 1E-2
250
- assert_in_delta(-0.41, @rasi.linear_regression.a, 1E-2)
251
- assert_in_delta(24.35, @rasi.linear_regression.b, 1E-2)
252
- assert !@rasi.linear_regression.slope_zero?
253
- assert_equal 13, @rasi.detect_outliers[:high]
254
- assert @rasi.detect_autocorrelation[:detected]
255
- assert_equal [4, 6, 11, 13, 22, 15, 12, 4, 7, 6],
256
- counts = @rasi.histogram(10).to_a.transpose[1]
257
- assert_equal 100, counts.inject { |s, x| s + x }
258
- end
259
-
260
- def test_book
261
- assert_equal 70, @book.size
262
- assert_in_delta 51.25, @book.mean, 1E-2
263
- assert_in_delta 49.70, @book.geometric_mean, 1E-2
264
- assert_in_delta 47.98, @book.harmonic_mean, 1E-2
265
- assert_in_delta 148.36, @book.variance, 1E-2
266
- assert_in_delta 12.18, @book.standard_deviation, 1E-2
267
- assert_in_delta 12.26, @book.sample_standard_deviation, 1E-2
268
- assert_in_delta 3588.0, @book.sum, 1E-2
269
- assert_in_delta 23, @book.min, 1E-2
270
- assert_in_delta 89, @book.max, 1E-2
271
- assert_in_delta(43.75, @book.percentile(25), 1E-2)
272
- assert_in_delta 51.5, @book.median, 1E-2
273
- assert_in_delta 58.25, @book.percentile(75), 1E-2
274
- assert_in_delta(-0.0952, @book.linear_regression.a, 1E-4)
275
- assert_in_delta(54.6372, @book.linear_regression.b, 1E-4)
276
- assert @book.linear_regression.slope_zero?
277
- assert_equal 7, @book.detect_outliers[:high]
278
- ought = [1.0, -0.39, 0.3, -0.17, 0.07, -0.10, 0.05, 0.04, -0.04, -0.01,
279
- 0.01, 0.11, -0.07, 0.15, 0.04, -0.01
280
- ]
281
- @book.autocorrelation[0, ought.size].zip(ought) do |x, x_o|
282
- assert_in_delta x, x_o, 8E-2
283
- end
284
- assert @book.detect_autocorrelation(10)[:detected]
285
- assert_equal [3, 4, 9, 12, 18, 14, 4, 5, 0, 1],
286
- counts = @book.histogram(10).to_a.transpose[1]
287
- assert_equal 70, counts.inject { |s, x| s + x }
288
- end
289
-
290
- def test_cover
291
- assert @flat.cover?(@flat)
292
- assert @flat_fuzzy2.cover?(@flat_fuzzy2)
293
- assert @flat_fuzzy.cover?(@flat_fuzzy)
294
- assert @flat.cover?(@flat_fuzzy)
295
- assert_operator @flat.suggested_sample_size(@flat_fuzzy), '>', 1000
296
- assert @flat.cover?(@flat_fuzzy2)
297
- assert_operator @flat.suggested_sample_size(@flat_fuzzy2), '>', 9000
298
- assert @flat_fuzzy.cover?(@flat)
299
- assert_operator @flat_fuzzy.suggested_sample_size(@flat), '>', 1000
300
- assert @flat_fuzzy2.cover?(@flat)
301
- assert_operator @flat_fuzzy2.suggested_sample_size(@flat), '>', 9000
302
- assert !@flat.cover?(@flat_higher)
303
- assert !@flat_higher.cover?(@flat)
304
- assert !@flat_fuzzy.cover?(@flat_higher)
305
- assert !@flat_fuzzy2.cover?(@flat_higher)
306
- assert !@flat_higher.cover?(@flat_fuzzy)
307
- assert !@flat_higher.cover?(@flat_fuzzy2)
308
- assert @flat_fuzzy.cover?(@flat_fuzzy2)
309
- assert_operator @flat_fuzzy.suggested_sample_size(@flat_fuzzy2), '>', 4000
310
- assert @flat_fuzzy2.cover?(@flat_fuzzy)
311
- assert_operator @flat_fuzzy2.suggested_sample_size(@flat_fuzzy), '>', 4000
312
- assert @rasi.cover?(@rasi_mean)
313
- assert_operator @rasi.suggested_sample_size(@rasi_mean), '>', 10_000
314
- assert @rasi_mean.cover?(@rasi)
315
- assert_operator @rasi_mean.suggested_sample_size(@rasi), '>', 10_000
316
- assert @rasi.cover?(@flat)
317
- assert_operator @rasi.suggested_sample_size(@flat), '>', 500
318
- assert @flat.cover?(@rasi)
319
- assert_operator @flat.suggested_sample_size(@rasi), '>', 500
320
- end
321
- end