141 lines
3.7 KiB
Plaintext
141 lines
3.7 KiB
Plaintext
<html>
|
|
<head>
|
|
<title>Coverage for <%= @source_file_name %></title>
|
|
<style>
|
|
body {
|
|
margin-left: 0px;
|
|
margin-right: 0px;
|
|
padding: 0px;
|
|
}
|
|
h2 {
|
|
text-align: center;
|
|
}
|
|
#overall_table {
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
#overall_table th {
|
|
text-align: right;
|
|
}
|
|
#overall_table td {
|
|
padding-left: 1ex;
|
|
}
|
|
#code_table {
|
|
border-collapse: collapse;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
#code_table th, #code_table td {
|
|
margin: 0px;
|
|
padding: 0px;
|
|
}
|
|
#code_table .padded {
|
|
padding: 0px 0.5ex;
|
|
}
|
|
#code_table th {
|
|
border-bottom: 1px solid black;
|
|
}
|
|
table th, table td {
|
|
vertical-align: top;
|
|
}
|
|
.code {
|
|
font-family: monospace;
|
|
}
|
|
.alignright {
|
|
text-align: right;
|
|
}
|
|
.borderright {
|
|
border-right: 1px solid black;
|
|
}
|
|
.normal-odd {
|
|
background-color: #bbffff;
|
|
}
|
|
.normal-even {
|
|
background-color: #99ffff;
|
|
}
|
|
.covered-odd {
|
|
background-color: #bbffbb;
|
|
}
|
|
.covered-even {
|
|
background-color: #99ff99;
|
|
}
|
|
.uncovered-odd {
|
|
background-color: #ffbbbb;
|
|
}
|
|
.uncovered-even {
|
|
background-color: #ff9999;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2>Coverage for <%= @source_file_name %></h2>
|
|
<table id="overall_table">
|
|
<tr>
|
|
<th>Line Coverage:</th>
|
|
<% if @total_lines > 0 %>
|
|
<td><%= @covered_lines %> / <%= @total_lines %> = <%= (100.0 * @covered_lines / @total_lines).to_i %>%</td>
|
|
<% else %>
|
|
<td>-</td>
|
|
<% end %>
|
|
</tr>
|
|
<tr>
|
|
<th>Branch Coverage:</th>
|
|
<% if @total_branches > 0 %>
|
|
<td><%= @covered_branches %> / <%= @total_branches %> = <%= (100.0 * @covered_branches / @total_branches).to_i %>%</td>
|
|
<% else %>
|
|
<td>-</td>
|
|
<% end %>
|
|
</tr>
|
|
</table>
|
|
<br/>
|
|
<table id="code_table">
|
|
<tr>
|
|
<th><span title="Branch Coverage">BC</span></th>
|
|
<th><span title="Line Coverage">LC</th></th>
|
|
<th>Line</th>
|
|
<th>Source</th>
|
|
</tr>
|
|
<% source_file_lines.each_with_index do |line, i| %>
|
|
<% line_number = i + 1 %>
|
|
<% line_execution_count = file_coverage.get_line_count(line_number) %>
|
|
<% if line_execution_count %>
|
|
<% if line_execution_count > 0 %>
|
|
<% row_coverage_style = "covered" %>
|
|
<% else %>
|
|
<% row_coverage_style = "uncovered" %>
|
|
<% end %>
|
|
<% else %>
|
|
<% row_coverage_style = "normal" %>
|
|
<% end %>
|
|
<% evenodd = i & 1 == 0 ? 'even' : 'odd' %>
|
|
<tr class="<%= row_coverage_style %>-<%= evenodd %>">
|
|
<td class="borderright">
|
|
<% if branches = file_coverage.get_branches(line_number) %>
|
|
<table class="alignright" style="position: relative; width: 100%; height: 100%; margin: 0px; padding: 0px;">
|
|
<% branches.each do |branch_id, branch_coverage| %>
|
|
<% if branch_coverage[:taken_count] > 0 %>
|
|
<% branch_coverage_style = "covered" %>
|
|
<% else %>
|
|
<% branch_coverage_style = "uncovered" %>
|
|
<% end %>
|
|
<tr class="<%= branch_coverage_style %>-<%= evenodd %>">
|
|
<td>
|
|
<% if branch_coverage[:branch_info] %>
|
|
(<%= branch_coverage[:branch_info] %>)
|
|
<% end %>
|
|
<%= branch_coverage[:taken_count] %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
<% end %>
|
|
</td>
|
|
<td class="padded alignright borderright"><%= line_execution_count %></td>
|
|
<td class="padded alignright borderright"><%= line_number %></td>
|
|
<td class="padded code"><%= CGI.escape_html(line.chomp).gsub("\t", " " * 4).gsub(" ", " ") %></td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
</body>
|
|
</html>
|