::xounit
Class DocumentationCoverageReport

Heritage:
::xotcl::Object
  |
  +--::xounit::CoverageReport
Class DocumentationCoverageReport
superclass ::xounit::CoverageReport,
Reports the documentation coverage for all methods,
 parameters and classes in a package.
Variables
NameDefault ValueClassComment
failures  0  ::xounit::CoverageReport
 number of methods that are not covered
passes  0  ::xounit::CoverageReport
 number of methods that are covered
prefixes    ::xounit::DocumentationCoverageReport
 Prefixes of methods used to limit the documentation coverage report
 
Methods
NameComment
add {class}   Adds a class to be watched during coverage analysis
addPackage {package}   Adds a package to be watched during coverage analysis
checkClassPrefix {class}   Checks that a Class matches a prefix listed in prefixes if prefixes were specified
checkMethodPrefix {method}   Checks that the method matches a prefix listed in prefixes if prefixes were specified
clear {}   Clears all old information from the CoverageReport
reportClass {class}   Builds the report of coverage for all methods in class
reportSummary {}   Builds the report summary for all classes included in this CoverageReport
start {}   Starts the recording of the CoverageReport
stop {}   Stops the recording of the CoverageReport
   
Methods from ::xounit::CoverageReport
add, addPackage, clear, reportClass, reportPackage, reportPackages, reportSummary, start, stop,
   
Methods from ::xotcl::Object
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
 
Instproc Detail

add

Description:
 Adds a class to be watched during coverage analysis.
Arguments:
Overrides:
add in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc add {class}  {
   

    
}

addPackage

Description:
 Adds a package to be watched during coverage analysis.
Arguments:
Overrides:
addPackage in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc addPackage {package}  {
   

    
}

checkClassPrefix

Description:
 Checks that a Class matches a prefix listed in prefixes if
 prefixes were specified.
Arguments:
Code:
  ::xounit::DocumentationCoverageReport instproc checkClassPrefix {class}  {
   

        my instvar prefixes

        if { ! [ my exists prefixes ] } { return 1 }

        foreach prefix $prefixes {

            if { [ string first $prefix [ namespace tail $class ] ] == 0 } { return 1 }
        }

        return 0
    
}

checkMethodPrefix

Description:
 Checks that the method matches a prefix listed in prefixes if 
 prefixes were specified.
Arguments:
Code:
  ::xounit::DocumentationCoverageReport instproc checkMethodPrefix {method}  {
   

        my instvar prefixes

        if { ! [ my exists prefixes ] } { return 1 }

        foreach prefix $prefixes {

            if { [ string first $prefix $method ] == 0 } { return 1 }
        }

        return 0
    
}

clear

Description:
 Clears all old information from the CoverageReport
Overrides:
clear in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc clear {}  {
   

        my passes 0
        my failures 0
    
}

reportClass

Description:
 Builds the report of coverage for all methods in class.
Arguments:
Overrides:
reportClass in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc reportClass {class}  {
   

        if { [ string first  "::test::" $class ] != -1 } { return }

        if { [ my checkClassPrefix $class ] } { 
        if {![ $class exists #([ namespace tail $class ]) ]} {

                puts "Not Covered: $class"
                my incr failures
        } else {
            puts "Covered: $class"
            my incr passes
        }
        }
         

        foreach method [ concat [ $class info instprocs ] [ $class info procs ] [ $class info parameter ] ] {

            set method [ lindex $method 0 ]
            if { ! [ my checkMethodPrefix $method ] } { continue }
            set currentClass $class
            set found 0

            while { "$currentClass" != "" } {
                
                if {[ $currentClass exists #($method) ]} {
                    set found 1
                    puts "Covered: $class $method"
                    my incr passes
                    break
                }

                set currentClass [ lindex [ $currentClass info superclass ] 0 ]
            }

            if { ! $found } {

                puts "Not Covered: $class $method"
                my incr failures
                continue
            }
        }
    
}

reportSummary

Description:
 Builds the report summary for all classes included in this
 CoverageReport
Overrides:
reportSummary in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc reportSummary {}  {
   

        my instvar passes failures

        set total [ expr { $passes + $failures } ]

        puts "\n\nDocumentation Coverage Report Summary by Method"
        puts "=========================================="
        puts "Total:        $total"
        if { $total == 0 } { return }
        puts "Covered:      $passes - [ expr { floor ( 100.0 * $passes / $total ) } ]%"
        puts "Not Covered:  $failures - [ expr { ceil ( 100.0 * $failures / $total ) } ]%"
        flush stdout
    
}

start

Description:
 Starts the recording of the CoverageReport
Overrides:
start in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc start {}  {
   

    
}

stop

Description:
 Stops the recording of the CoverageReport
Overrides:
stop in ::xounit::CoverageReport
Code:
  ::xounit::DocumentationCoverageReport instproc stop {}  {
   

    
}