1 <?xml version="1.0" encoding="utf-8"?>
\r
4 # Copyright (C) 2006 Daniel Berrange
\r
6 # This program is free software; you can redistribute it and/or modify
\r
7 # it under the terms of the GNU General Public License as published by
\r
8 # the Free Software Foundation; either version 2 of the License, or
\r
9 # (at your option) any later version.
\r
11 # This program is distributed in the hope that it will be useful,
\r
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 # GNU General Public License for more details.
\r
16 # You should have received a copy of the GNU General Public License
\r
17 # along with this program; if not, write to the Free Software
\r
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
23 <xsl:output method="html"/>
\r
25 <xsl:template match="coverage">
\r
28 <title>Coverage report</title>
\r
29 <style type="text/css">
\r
30 tbody tr.odd td.label {
\r
31 border-top: 1px solid rgb(128,128,128);
\r
32 border-bottom: 1px solid rgb(128,128,128);
\r
34 tbody tr.odd td.label {
\r
35 background: rgb(200,200,200);
\r
39 background: rgb(60,60,60);
\r
45 background: rgb(0,255,0);
\r
49 background: rgb(140,255,140);
\r
53 background: rgb(160,255,0);
\r
57 background: rgb(255,160,0);
\r
61 background: rgb(255,140,140);
\r
65 background: rgb(255,0,0);
\r
71 <h1>Coverage report</h1>
\r
72 <xsl:apply-templates/>
\r
77 <xsl:template match="functions">
\r
78 <h2>Function coverage</h2>
\r
79 <xsl:call-template name="content">
\r
80 <xsl:with-param name="type" select="'function'"/>
\r
81 </xsl:call-template>
\r
85 <xsl:template match="files">
\r
86 <h2>File coverage</h2>
\r
87 <xsl:call-template name="content">
\r
88 <xsl:with-param name="type" select="'file'"/>
\r
89 </xsl:call-template>
\r
92 <xsl:template name="content">
\r
93 <xsl:param name="type"/>
\r
100 <th>Conditions</th>
\r
105 <xsl:for-each select="entry">
\r
106 <xsl:call-template name="entry">
\r
107 <xsl:with-param name="type" select="$type"/>
\r
108 <xsl:with-param name="class">
\r
110 <xsl:when test="position() mod 2">
\r
111 <xsl:text>odd</xsl:text>
\r
114 <xsl:text>even</xsl:text>
\r
118 </xsl:call-template>
\r
122 <xsl:for-each select="summary">
\r
123 <xsl:call-template name="entry">
\r
124 <xsl:with-param name="type" select="'summary'"/>
\r
125 <xsl:with-param name="class">
\r
127 <xsl:when test="position() mod 2">
\r
128 <xsl:text>odd</xsl:text>
\r
131 <xsl:text>even</xsl:text>
\r
135 </xsl:call-template>
\r
141 <xsl:template name="entry">
\r
142 <xsl:param name="type"/>
\r
143 <xsl:param name="class"/>
\r
144 <tr class="{$class}">
\r
146 <xsl:when test="$type = 'function'">
\r
147 <td class="label"><a href="{@details}.html#{@name}"><xsl:value-of select="@name"/></a></td>
\r
149 <xsl:when test="$type = 'file'">
\r
150 <td class="label"><a href="{@details}.html"><xsl:value-of select="@name"/></a></td>
\r
153 <td class="label">Summary</td>
\r
157 <xsl:if test="count(lines)">
\r
158 <xsl:apply-templates select="lines"/>
\r
160 <xsl:if test="not(count(lines))">
\r
161 <xsl:call-template name="missing"/>
\r
164 <xsl:if test="count(branches)">
\r
165 <xsl:apply-templates select="branches"/>
\r
167 <xsl:if test="not(count(branches))">
\r
168 <xsl:call-template name="missing"/>
\r
171 <xsl:if test="count(conditions)">
\r
172 <xsl:apply-templates select="conditions"/>
\r
174 <xsl:if test="not(count(conditions))">
\r
175 <xsl:call-template name="missing"/>
\r
178 <xsl:if test="count(calls)">
\r
179 <xsl:apply-templates select="calls"/>
\r
181 <xsl:if test="not(count(calls))">
\r
182 <xsl:call-template name="missing"/>
\r
188 <xsl:template match="lines">
\r
189 <xsl:call-template name="row"/>
\r
192 <xsl:template match="branches">
\r
193 <xsl:call-template name="row"/>
\r
196 <xsl:template match="conditions">
\r
197 <xsl:call-template name="row"/>
\r
200 <xsl:template match="calls">
\r
201 <xsl:call-template name="row"/>
\r
204 <xsl:template name="missing">
\r
208 <xsl:template name="row">
\r
209 <xsl:variable name="quality">
\r
211 <xsl:when test="@coverage = 100">
\r
212 <xsl:text>perfect</xsl:text>
\r
214 <xsl:when test="@coverage >= 80.0">
\r
215 <xsl:text>excellant</xsl:text>
\r
217 <xsl:when test="@coverage >= 60.0">
\r
218 <xsl:text>good</xsl:text>
\r
220 <xsl:when test="@coverage >= 40.0">
\r
221 <xsl:text>poor</xsl:text>
\r
223 <xsl:when test="@coverage >= 20.0">
\r
224 <xsl:text>bad</xsl:text>
\r
227 <xsl:text>terrible</xsl:text>
\r
232 <td class="{$quality}"><xsl:value-of select="@coverage"/>% of <xsl:value-of select="@count"/></td>
\r