minitest-check 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minitest-check.rb +19 -17
- data/lib/minitest-check/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3c7d6524ee47a298c293a92bf4faa96cf3832b
|
4
|
+
data.tar.gz: f1890379b803b5795f69a56b54aca68f02650b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c8f8091ed2053652ac52c5df0afcb7e053c5cd96288d36e8fd80301afab6c53faad81adf5e9afdaccb173b594edec3900bbc691bcdcf958233d5bc9fed91a5d
|
7
|
+
data.tar.gz: 26f46bb7e14f00075ef805150043f67cca26a88b1c94fec3d58ba47ec24e5cf621118f30a1502a751bf96c5cd93e4986a0951d212de964654f1cf3d1f39b3655
|
data/lib/minitest-check.rb
CHANGED
@@ -157,24 +157,26 @@ module MiniTest
|
|
157
157
|
def draw_graph(pairs, io, max_width = 80)
|
158
158
|
if pairs
|
159
159
|
data_groups = pairs.group_by {|d| d[1] == 1 ? :singles : :multis }
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
0
|
167
|
-
end
|
168
|
-
|
169
|
-
data.each do |(value, num)|
|
170
|
-
num_string = num.to_s
|
171
|
-
num_length = num_string.length
|
172
|
-
bar_length = (num.to_f * scale).to_i
|
173
|
-
fill_length = bar_length - num_length
|
174
|
-
if fill_length > 0
|
175
|
-
io.puts "#{value.to_s.ljust(largest_value_width)} | #{num_string}#{'#' * fill_length}"
|
160
|
+
if multis = data_groups[:multis]
|
161
|
+
data = multis.to_a.sort {|a,b| b[1] <=> a[1]}
|
162
|
+
largest_value_width = data.map {|d| d[0].length}.max
|
163
|
+
largest_num = data[0][1]
|
164
|
+
scale = if largest_num > 0
|
165
|
+
(max_width - largest_value_width - 3).to_f / largest_num.to_f
|
176
166
|
else
|
177
|
-
|
167
|
+
0
|
168
|
+
end
|
169
|
+
|
170
|
+
data.each do |(value, num)|
|
171
|
+
num_string = num.to_s
|
172
|
+
num_length = num_string.length
|
173
|
+
bar_length = (num.to_f * scale).to_i
|
174
|
+
fill_length = bar_length - num_length
|
175
|
+
if fill_length > 0
|
176
|
+
io.puts "#{value.to_s.ljust(largest_value_width)} | #{num_string}#{'#' * fill_length}"
|
177
|
+
else
|
178
|
+
io.puts "#{value.to_s.ljust(largest_value_width)} | #{'#' * bar_length} (#{num_string})"
|
179
|
+
end
|
178
180
|
end
|
179
181
|
end
|
180
182
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew O'Brien
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-25 00:00:00 Z
|
13
13
|
dependencies: []
|
14
14
|
|
15
15
|
description: Generative testing for Minitest.
|