-#!/bin/sh
+#!/usr/bin/python
+
import os
import glob
import re
sys.stdout.write ('%8s:%8d:%s' % (cov, n, l))
def uncovered_score (self):
- return length (self)
+ return self.length ()
class SchemeChunk (Chunk):
def uncovered_score (self):
text = self.text ()
- if (text.startswith ('(define')
+ if (text.startswith ('(define ')
and not text.startswith ('(define (')):
return 0
+ if text.startswith ('(use-modules '):
+ return 0
+
+ if (text.startswith ('(define-public ')
+ and not text.startswith ('(define-public (')):
+ return 0
+
return len ([l for (c,n,l) in self.lines() if (c == 0)])
def read_gcov (f):
ls = []
in_lines = [l for l in open (f).readlines ()]
- (count_len, line_num_len) = tuple (map (len, in_lines[0].split( ':')[:2]))
+ (count_len, line_num_len) = tuple (map (len, in_lines[0].split (':')[:2]))
for l in in_lines:
c = l[:count_len].strip ()
last_c = -1
for (cov_count, line_number, line) in ls:
- if line.startswith ('(define'):
+ if line.startswith ('('):
new_chunk ()
last_c = -1
if options.uncovered:
chunks = filter_uncovered (chunks)
- chunks = [(c.uncovered_score (), c) for c in chunks]
+ chunks = [(c.uncovered_score (), c) for c in chunks if c.uncovered_score() > 0]
elif options.hotspots:
chunks = [((c.coverage_count, -c.length()), c) for c in chunks]