enumstats 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Guardfile +10 -0
- data/enumstats.gemspec +6 -0
- data/lib/enumstats/version.rb +1 -1
- data/test/unit/test_enumerable_stats.rb +11 -0
- metadata +83 -2
data/Guardfile
ADDED
data/enumstats.gemspec
CHANGED
@@ -18,4 +18,10 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_development_dependency 'rake'
|
19
19
|
gem.add_development_dependency 'open4'
|
20
20
|
gem.add_development_dependency 'pry'
|
21
|
+
gem.add_development_dependency 'hms', '~> 0.0.3'
|
22
|
+
|
23
|
+
gem.add_development_dependency 'guard-minitest', '~> 0.5'
|
24
|
+
gem.add_development_dependency 'guard-bundler', '~> 1.0'
|
25
|
+
gem.add_development_dependency 'coolline', '~> 0.3'
|
26
|
+
gem.add_development_dependency 'growl'
|
21
27
|
end
|
data/lib/enumstats/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'helper'
|
2
|
+
require 'hms'
|
2
3
|
|
3
4
|
class TestEnumerableStats < MiniTest::Unit::TestCase
|
4
5
|
def test_stats_example1
|
@@ -44,4 +45,14 @@ class TestEnumerableStats < MiniTest::Unit::TestCase
|
|
44
45
|
samples = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
|
45
46
|
assert_in_delta(9, samples.median, 0.0001)
|
46
47
|
end
|
48
|
+
|
49
|
+
def test_stats_duration
|
50
|
+
samples = [5.0, 10.0, 15.0].map{|f| HMS::Duration.new(f)}
|
51
|
+
assert_in_delta(10.0, samples.mean, 1e-6)
|
52
|
+
assert_in_delta(25.0, samples.variance, 1e-6)
|
53
|
+
assert_in_delta(5.0, samples.standard_deviation, 1e-6)
|
54
|
+
assert_in_delta(30.0, samples.sum, 1e-6)
|
55
|
+
assert_in_delta(5.0, samples.min, 1e-6)
|
56
|
+
assert_in_delta(15.0, samples.max, 1e-6)
|
57
|
+
end
|
47
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -59,6 +59,86 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: hms
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.0.3
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.0.3
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-minitest
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0.5'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0.5'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: guard-bundler
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: coolline
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.3'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: growl
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
62
142
|
description: Adds simple stats like average, variance and standard deviation to Enumerable
|
63
143
|
email:
|
64
144
|
- nerab@gmx.net
|
@@ -70,6 +150,7 @@ files:
|
|
70
150
|
- .gitignore
|
71
151
|
- .travis.yml
|
72
152
|
- Gemfile
|
153
|
+
- Guardfile
|
73
154
|
- LICENSE
|
74
155
|
- README.md
|
75
156
|
- Rakefile
|