gcov2x 0.4.3 → 0.4.4
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.
- checksums.yaml +4 -4
- data/lib/project.rb +10 -2
- data/lib/version.rb +1 -1
- data/spec/gcov2x/project_spec.rb +33 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffc25780e4cd8a34e6bdd34e5bc8e5e994b97bad
|
4
|
+
data.tar.gz: cb9bf064b36beeea8d7c4049160ac6b1ac7446ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78ba1059c5cbdc8e892a7e1c83e65b3a6225fef14816d9f39a7607f4fc0af3f7426a94e8d6be0a9c0275bdaaa6f7fefdaadf67586a52e0d0a79705b0454cf77f
|
7
|
+
data.tar.gz: 1d42409446b10421d95fad13fdef204680e7b960313f5c6ce57c40fee67c2943f3f2241d03f461e8a676aae9bb3431c8908c5a5c5d96bb5493363995e4924dc7
|
data/lib/project.rb
CHANGED
@@ -54,10 +54,18 @@ module GCOV
|
|
54
54
|
|
55
55
|
@stats[:lines] = @stats[:exec_lines] + @stats[:missed_lines]
|
56
56
|
@stats[:total_lines] = @stats[:lines] + @stats[:empty_lines]
|
57
|
-
|
57
|
+
|
58
|
+
if @stats[:lines] > 0
|
59
|
+
@stats[:coverage] = @stats[:exec_lines].to_f / @stats[:lines].to_f
|
60
|
+
@stats[:hits_per_line] = @stats[:total_exec].to_f / @stats[:lines]
|
61
|
+
else
|
62
|
+
@stats[:coverage] = 1
|
63
|
+
@stats[:hits_per_line] = 0
|
64
|
+
end
|
65
|
+
|
58
66
|
@stats[:coverage_s] = sprintf("%0.01f%",100.0*@stats[:coverage])
|
59
|
-
@stats[:hits_per_line] = @stats[:total_exec].to_f / @stats[:lines]
|
60
67
|
@stats[:hits_per_line_s] = sprintf("%0.02f",@stats[:hits_per_line])
|
68
|
+
|
61
69
|
end
|
62
70
|
|
63
71
|
def add_dir path, hash={}
|
data/lib/version.rb
CHANGED
data/spec/gcov2x/project_spec.rb
CHANGED
@@ -135,5 +135,36 @@ describe GCOV::Project do
|
|
135
135
|
expect(project.stats[:hits_per_line]).to eq(67.0/5)
|
136
136
|
|
137
137
|
end
|
138
|
-
|
139
|
-
|
138
|
+
|
139
|
+
it "should be computed based on file stats" do
|
140
|
+
project = GCOV::Project.new
|
141
|
+
|
142
|
+
project.add_files do
|
143
|
+
file = GCOV::File.new "myfile.cpp"
|
144
|
+
file.add_lines do
|
145
|
+
file << GCOV::Line.new(1,:none,"line 1")
|
146
|
+
file << GCOV::Line.new(2,:none,"line 2")
|
147
|
+
file << GCOV::Line.new(3,:none,"line 3")
|
148
|
+
file << GCOV::Line.new(4,:none,"line 4")
|
149
|
+
end
|
150
|
+
|
151
|
+
project << file
|
152
|
+
|
153
|
+
file = GCOV::File.new "myfile2.cpp"
|
154
|
+
file.add_lines do
|
155
|
+
file << GCOV::Line.new(1,:none,"line 1")
|
156
|
+
file << GCOV::Line.new(2,:none,"line 2")
|
157
|
+
end
|
158
|
+
|
159
|
+
project << file
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
expect(project.stats[:lines]).to eq(0)
|
164
|
+
expect(project.stats[:coverage]).to eq(1)
|
165
|
+
expect(project.stats[:hits_per_line]).to eq(0)
|
166
|
+
|
167
|
+
end # it
|
168
|
+
end # describe #stats
|
169
|
+
|
170
|
+
end # describe Project
|