root/trunk/uncover.d

Revision 51, 1.8 kB (checked in by Don Clugston, 3 years ago)

Tracked down the bug in gammadistCompl (NaN created when input too large -- CEPHES failed in this case).
Removed all tabs from all source files. This destroys the change history, but it's better to do it now.

Covered: 1084 Uncovered: 111 -- 90.7%

Line 
1 /**
2  Simple program for displaying the coverage percentages of all LST files in a directory.
3 */
4 import std.stdio;
5 import std.stream;
6 import std.path;
7 import std.file;
8
9
10 void main()
11 {
12     int totaluncovered = 0;
13     int totalcovered = 0;
14
15     void writesummary(int cov, int uncov, char [] name)
16     {
17         if (uncov==0) {
18             writefln("%d\t-----\t------\t", cov, name);   
19         } else {
20             real percent = 100.0 * cov/(cov+uncov);
21             writefln("%d\t%d\t%0.2f%%\t", cov, uncov, percent, name);   
22         }
23     }
24  
25     void processfile(char [] fname) {
26         int numuncovered = 0;
27         int numcovered = 0;
28         int blank=0;
29         int other = 0;
30         File infile = new File(fname, FileMode.In);
31         char [] buf;
32         while (!infile.eof) {
33             char [] buff = infile.readLine(buf);
34             if (buff.length<9) { other++; continue; }
35             if (buff[7]!='|') { other++; continue; }
36             if (buff[0..8] == "       |") { blank++; continue; }
37             if (buff[0..8] == "0000000|") numuncovered++; else numcovered++;
38         }       
39 //        writefln("%d\t%d\t%d\t%d\t", blank, other, numcovered, numuncovered, fname);
40         writesummary(numcovered, numuncovered, fname);
41         totaluncovered += numuncovered;
42         totalcovered += numcovered;
43     }
44    
45     writefln("----------------------------------------");
46     writefln("Covered\tUncovd\tPercent\tFilename");
47     writefln("----------------------------------------");
48     foreach( char [] str; listdir(getcwd())) {
49         if (fnmatch(str, "*.lst")) processfile(str);
50     }
51     writefln("----------------------------------------");
52     writesummary(totalcovered, totaluncovered, "TOTAL");
53     writefln("----------------------------------------");
54 }
Note: See TracBrowser for help on using the browser.