Blame common/coverage/coverage-report.xsl

Packit 971217

Packit 971217
Packit 971217
#
Packit 971217
# Copyright (C) 2006 Daniel Berrange
Packit 971217
#
Packit 971217
# This program is free software; you can redistribute it and/or modify
Packit 971217
# it under the terms of the GNU General Public License as published by
Packit 971217
# the Free Software Foundation; either version 2 of the License, or
Packit 971217
# (at your option) any later version.
Packit 971217
#
Packit 971217
# This program is distributed in the hope that it will be useful,
Packit 971217
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 971217
# GNU General Public License for more details.
Packit 971217
#
Packit 971217
# You should have received a copy of the GNU General Public License
Packit 971217
# along with this program; if not, write to the Free Software
Packit 971217
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 971217
-->
Packit 971217
Packit 971217
                version="1.0">
Packit 971217

Packit 971217
  <xsl:output method="html"/>
Packit 971217

Packit 971217
  <xsl:template match="coverage">
Packit 971217
    <html>
Packit 971217
      <head>
Packit 971217
        <title>Coverage report</title>
Packit 971217
        <style type="text/css">
Packit 971217
          tbody tr.odd td.label {
Packit 971217
            border-top: 1px solid rgb(128,128,128);
Packit 971217
            border-bottom: 1px solid rgb(128,128,128);
Packit 971217
          }
Packit 971217
          tbody tr.odd td.label {
Packit 971217
            background: rgb(200,200,200);
Packit 971217
          }
Packit 971217
          
Packit 971217
          thead, tfoot {
Packit 971217
            background: rgb(60,60,60);
Packit 971217
            color: white;
Packit 971217
            font-weight: bold;
Packit 971217
          }
Packit 971217

Packit 971217
          tr td.perfect {
Packit 971217
            background: rgb(0,255,0);
Packit 971217
            color: black;
Packit 971217
          }
Packit 971217
          tr td.excellant {
Packit 971217
            background: rgb(140,255,140);
Packit 971217
            color: black;
Packit 971217
          }
Packit 971217
          tr td.good {
Packit 971217
            background: rgb(160,255,0);
Packit 971217
            color: black;
Packit 971217
          }
Packit 971217
          tr td.poor {
Packit 971217
            background: rgb(255,160,0);
Packit 971217
            color: black;
Packit 971217
          }
Packit 971217
          tr td.bad {
Packit 971217
            background: rgb(255,140,140);
Packit 971217
            color: black;
Packit 971217
          }
Packit 971217
          tr td.terrible {
Packit 971217
            background: rgb(255,0,0);
Packit 971217
            color: black;
Packit 971217
          }
Packit 971217
        </style>
Packit 971217
      </head>
Packit 971217
      <body>
Packit 971217
        

Coverage report

Packit 971217
        <xsl:apply-templates/>
Packit 971217
      </body>
Packit 971217
    </html>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template match="functions">
Packit 971217
    

Function coverage

Packit 971217
    <xsl:call-template name="content">
Packit 971217
      <xsl:with-param name="type" select="'function'"/>
Packit 971217
    </xsl:call-template>
Packit 971217
  </xsl:template>
Packit 971217
  
Packit 971217

Packit 971217
  <xsl:template match="files">
Packit 971217
    

File coverage

Packit 971217
    <xsl:call-template name="content">
Packit 971217
      <xsl:with-param name="type" select="'file'"/>
Packit 971217
    </xsl:call-template>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template name="content">
Packit 971217
    <xsl:param name="type"/>
Packit 971217
    
Packit 971217
      
Packit 971217
        
Packit 971217
          Name
Packit 971217
          Lines
Packit 971217
          Branches
Packit 971217
          Conditions
Packit 971217
          Calls
Packit 971217
        
Packit 971217
      
Packit 971217
      
Packit 971217
        <xsl:for-each select="entry">
Packit 971217
          <xsl:call-template name="entry">
Packit 971217
            <xsl:with-param name="type" select="$type"/>
Packit 971217
            <xsl:with-param name="class">
Packit 971217
              <xsl:choose>
Packit 971217
                <xsl:when test="position() mod 2">
Packit 971217
                  <xsl:text>odd</xsl:text>
Packit 971217
                </xsl:when>
Packit 971217
                <xsl:otherwise>
Packit 971217
                  <xsl:text>even</xsl:text>
Packit 971217
                </xsl:otherwise>
Packit 971217
              </xsl:choose>
Packit 971217
            </xsl:with-param>
Packit 971217
          </xsl:call-template>
Packit 971217
        </xsl:for-each>
Packit 971217
      
Packit 971217
      <tfoot>
Packit 971217
        <xsl:for-each select="summary">
Packit 971217
          <xsl:call-template name="entry">
Packit 971217
            <xsl:with-param name="type" select="'summary'"/>
Packit 971217
            <xsl:with-param name="class">
Packit 971217
              <xsl:choose>
Packit 971217
                <xsl:when test="position() mod 2">
Packit 971217
                  <xsl:text>odd</xsl:text>
Packit 971217
                </xsl:when>
Packit 971217
                <xsl:otherwise>
Packit 971217
                  <xsl:text>even</xsl:text>
Packit 971217
                </xsl:otherwise>
Packit 971217
              </xsl:choose>
Packit 971217
            </xsl:with-param>
Packit 971217
          </xsl:call-template>
Packit 971217
        </xsl:for-each>
Packit 971217
      </tfoot>
Packit 971217
    
Packit 971217
  </xsl:template>
Packit 971217
  
Packit 971217
  <xsl:template name="entry">
Packit 971217
    <xsl:param name="type"/>
Packit 971217
    <xsl:param name="class"/>
Packit 971217
    
Packit 971217
      <xsl:choose>
Packit 971217
        <xsl:when test="$type = 'function'">
Packit 971217
          <xsl:value-of select="@name"/>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:when test="$type = 'file'">
Packit 971217
          <xsl:value-of select="@name"/>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:otherwise>
Packit 971217
          Summary
Packit 971217
        </xsl:otherwise>
Packit 971217
      </xsl:choose>
Packit 971217

Packit 971217
      <xsl:if test="count(lines)">
Packit 971217
        <xsl:apply-templates select="lines"/>
Packit 971217
      </xsl:if>
Packit 971217
      <xsl:if test="not(count(lines))">
Packit 971217
        <xsl:call-template name="missing"/>
Packit 971217
      </xsl:if>
Packit 971217

Packit 971217
      <xsl:if test="count(branches)">
Packit 971217
        <xsl:apply-templates select="branches"/>
Packit 971217
      </xsl:if>
Packit 971217
      <xsl:if test="not(count(branches))">
Packit 971217
        <xsl:call-template name="missing"/>
Packit 971217
      </xsl:if>
Packit 971217

Packit 971217
      <xsl:if test="count(conditions)">
Packit 971217
        <xsl:apply-templates select="conditions"/>
Packit 971217
      </xsl:if>
Packit 971217
      <xsl:if test="not(count(conditions))">
Packit 971217
        <xsl:call-template name="missing"/>
Packit 971217
      </xsl:if>
Packit 971217

Packit 971217
      <xsl:if test="count(calls)">
Packit 971217
        <xsl:apply-templates select="calls"/>
Packit 971217
      </xsl:if>
Packit 971217
      <xsl:if test="not(count(calls))">
Packit 971217
        <xsl:call-template name="missing"/>
Packit 971217
      </xsl:if>
Packit 971217

Packit 971217
    
Packit 971217
  </xsl:template>
Packit 971217
  
Packit 971217
  <xsl:template match="lines">
Packit 971217
    <xsl:call-template name="row"/>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template match="branches">
Packit 971217
    <xsl:call-template name="row"/>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template match="conditions">
Packit 971217
    <xsl:call-template name="row"/>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template match="calls">
Packit 971217
    <xsl:call-template name="row"/>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template name="missing">
Packit 971217
    
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
  <xsl:template name="row">
Packit 971217
    <xsl:variable name="quality">
Packit 971217
      <xsl:choose>
Packit 971217
        <xsl:when test="@coverage = 100">
Packit 971217
          <xsl:text>perfect</xsl:text>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:when test="@coverage >= 80.0">
Packit 971217
          <xsl:text>excellant</xsl:text>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:when test="@coverage >= 60.0">
Packit 971217
          <xsl:text>good</xsl:text>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:when test="@coverage >= 40.0">
Packit 971217
          <xsl:text>poor</xsl:text>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:when test="@coverage >= 20.0">
Packit 971217
          <xsl:text>bad</xsl:text>
Packit 971217
        </xsl:when>
Packit 971217
        <xsl:otherwise>
Packit 971217
          <xsl:text>terrible</xsl:text>
Packit 971217
        </xsl:otherwise>
Packit 971217
      </xsl:choose>
Packit 971217
    </xsl:variable>
Packit 971217
    
Packit 971217
    <xsl:value-of select="@coverage"/>% of <xsl:value-of select="@count"/>
Packit 971217
  </xsl:template>
Packit 971217

Packit 971217
</xsl:stylesheet>