Go to the first, previous, next, last section, table of contents.


Coverage Testing

Edebug provides rudimentary coverage testing and display of execution frequency. All execution of an instrumented function accumulates frequency counts, both before and after evaluation of each instrumented expression, even if the execution mode is Go-nonstop. Coverage testing is more expensive, so it is only done if edebug-test-coverage is non-nil. The command M-x edebug-display-freq-count displays both the frequency data and the coverage data (if recorded).

Command: edebug-display-freq-count
This command displays the frequency count data for each line of the current definition.

The frequency counts appear as comment lines after each line of code, and you can undo all insertions with one undo command. The counts appear under the ( before an expression or the ) after an expression, or on the last character of a symbol. Values do not appear if they are equal to the previous count on the same line.

The character `=' following the count for an expression says that the expression has returned the same value each time it was evaluated This is the only coverage information that Edebug records.

To clear the frequency count and coverage data for a definition, reinstrument it.

For example, after evaluating (fac 5) with a source breakpoint, and setting edebug-test-coverage to t, when the breakpoint is reached, the frequency data looks like this:

(defun fac (n)
  (if (= n 0) (edebug))
;#6           1      0 =5 
  (if (< 0 n)
;#5         = 
      (* n (fac (1- n)))
;#    5               0  
    1))
;#   0 

The comment lines show that fac was called 6 times. The first if statement returned 5 times with the same result each time; the same is true of the condition on the second if. The recursive call of fac did not return at all.


Go to the first, previous, next, last section, table of contents.