quicky 0.1.0 → 0.1.1
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.
- data/Gemfile.lock +1 -1
- data/lib/quicky/results_hash.rb +15 -0
- data/lib/quicky/timer.rb +16 -2
- data/lib/quicky/version.rb +1 -1
- data/test/test_basics.rb +3 -0
- metadata +3 -2
data/Gemfile.lock
CHANGED
data/lib/quicky/timer.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
require_relative 'results_hash'
|
2
|
+
|
1
3
|
module Quicky
|
2
4
|
|
3
5
|
class Timer
|
4
6
|
|
5
7
|
def initialize
|
6
|
-
@collector =
|
8
|
+
@collector = ResultsHash.new
|
7
9
|
end
|
8
10
|
|
9
11
|
def loop(name, x, options={}, &blk)
|
@@ -52,9 +54,10 @@ module Quicky
|
|
52
54
|
end
|
53
55
|
|
54
56
|
class TimeCollector
|
55
|
-
INT_MAX = (
|
57
|
+
INT_MAX = ((2 ** (32 - 2)) - 1)
|
56
58
|
|
57
59
|
attr_accessor :name
|
60
|
+
|
58
61
|
def initialize(name)
|
59
62
|
@name = name
|
60
63
|
@collector = []
|
@@ -91,6 +94,17 @@ module Quicky
|
|
91
94
|
@collector.size
|
92
95
|
end
|
93
96
|
|
97
|
+
def to_hash
|
98
|
+
{
|
99
|
+
name: self.name,
|
100
|
+
count: self.count,
|
101
|
+
duration: self.duration,
|
102
|
+
total_duration: self.total_duration,
|
103
|
+
max_duration: self.max_duration,
|
104
|
+
min_duration: self.min_duration
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
94
108
|
end
|
95
109
|
|
96
110
|
class TimeResult
|
data/lib/quicky/version.rb
CHANGED
data/test/test_basics.rb
CHANGED
@@ -42,6 +42,9 @@ class TestBasics < TestBase
|
|
42
42
|
assert result.min_duration < 0.55 && result.min_duration > 0.1
|
43
43
|
assert result.max_duration > 0.5 && result.max_duration < 0.7
|
44
44
|
|
45
|
+
hash = quicky.results.to_hash
|
46
|
+
p hash
|
47
|
+
assert hash[:test3][:duration] >= 0.5
|
45
48
|
|
46
49
|
end
|
47
50
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quicky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
43
|
- lib/quicky.rb
|
44
|
+
- lib/quicky/results_hash.rb
|
44
45
|
- lib/quicky/timer.rb
|
45
46
|
- lib/quicky/version.rb
|
46
47
|
- quicky.gemspec
|