File: test1.cc

package info (click to toggle)
cccc 1%3A3.1.4-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,956 kB
  • sloc: ansic: 33,244; cpp: 10,527; java: 622; makefile: 156; sh: 11
file content (69 lines) | stat: -rw-r--r-- 3,009 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//## test1.cc 
//## test case illustrating simple procedural metrics
//## Lines starting //## are ignored by CCCC so they will be used in this
//## file for explanatory comments (as opposed to comments which we wish
//## to count).
//## The file is annotated along the way with comment lines like these
//## scope/comment                                          LOC   COM   MVG
//## definition of class Test1 (start)                        0     0     0
//## running totals                                           0     0     0
//## definition of class Test1 (end)                          0     0     0
//## Note that extents nest, so there is effectively a stack of 
//## running totals for each extent open at a particular point in a file

//## definition of class Test1 (start)                        0     0     0
// Leading comment for class.
class Test1
{
//## running totals                                           2     1     0
  // Internal comment for class. 
  // This should not be associated with the following function due to 
  // the intervening visibility declaration.
//## running totals                                           2     4     0
public:
//## running totals for definition of class Test1 (push)      3     4     0
//## definition of method Test1::method1 (start)              0     0     0
  // Leading comment for inline method
  void method1()
    {
//## running totals                                           2     1     0
      int s=1;
      switch(s)
//## running totals                                           4     1     1
	{
	case 1:
	  break;
//## running totals                                           7     1     2
	case 2:
	  break;
//## running totals                                           9     1     3
	default:
	  break;
//## running totals                                          11     1     4
	}
    }
//## definition of method Test1::method1 (end)               13     1     4
//## running totals for definition of class Test1 (pop+push)  3     4     0
//## declaration of method Test1::method2 (start)             0     0     0
  void method2();
//## declaration of method Test1::method2 (end)               1     0     0
//## running totals for definition of class Test1 (pop)       3     4     0
};
//## definition of class Test1 (end)                          4     4     0

//## definition of method Test1::method2 (start)              0     0     0
void Test1::method2()
{
  if(1)
    {
      // do nothing
    }
 }
//## definition of method Test1::method2 (end)                6     1     1

//## after processing the whole file we expect to find the following
//## extents recognized and mentioned in the .db file
//## definition of class Test1                               LOC:4 COM:4 MVG:0
//## definition of method Test1::method1                     LOC:13 COM:1 MVG:4
//## declaration of method Test1::method2                    LOC:1 COM:0 MVG:0
//## definition of method Test1::method2                     LOC:6 COM:1 MVG:1