[Issue 4153] Code coverage output improvement
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 5 02:14:42 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4153
--- Comment #1 from bearophile_hugs at eml.cc 2010-05-05 02:13:59 PDT ---
Improved version of the Python script:
filename = "test"
counts_divisor_thousands = 0 # 0, 1 or 2
def thousands(n, separator="_"):
sign = "-" if n < 0 else ""
n = str(abs(n))[::-1]
parts = [n[i:i+3] for i in xrange(0, len(n), 3)]
return sign + separator.join(parts)[::-1]
lines = [l.rstrip() for l in file(filename+ ".lst")][:-1]
parts = [l.split("|", 1) for l in lines]
divisor = 10 ** (counts_divisor_thousands * 3)
for count, code in parts:
count = count.strip()
if count and count != "0000000":
count = thousands(int(count) / divisor)
# len of the maximum count
ncols = max(len(count) for count, code in parts)
for count, code in parts:
if count:
if count == "0000000":
print ("=" * ncols) + "|" + code
else:
print count.rjust(ncols) + "|" + code
else:
print (" " * ncols) + "|" + code
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list