File: test3.cc

package info (click to toggle)
cccc 1:3.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 (55 lines) | stat: -rw-r--r-- 1,605 bytes parent folder | download | duplicates (8)
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
//## test3.cc
//## This file is intended to test the performance of CCCC in measurement
//## of the metrics described in the papers by Chidamber and Kemerer
//## about 'a metrics suite for object oriented design'.

//## Test3a attempts to check the values for WMC1 and WMCv
//## When I was originally writing this class I found some bugs in the 
//## handling of operator functions, hence the fact that they are
//## extensively used in this item.
class Test3a
{
public:
  Test3a();
  ~Test3a();
  operator new();
  operator delete[]();
protected:
  operator!=();
  operator unsigned long int();
private:
  operator==();
  operator ()();
  operator []();
  operator*();
  operator.*();
  do_something();
  do_something_else();
};
//## Manual count of the above definition yields WMC1=13, WMCv=6 (including 
//## protected functions which we treat as visible).

//## Test3b1 to Test3b5 attempt to test the logic for DIT, NOC and CBO.
class Test3b1 : public Test3b0 {};
class Test3b2 : public Test3b1 {};
class Test3b4 : public Test3b3, public Test3b0, public Test3b2 {};
class Test3b5
{
public:
  Test3b5(Test3b3);
private:
  Test3b0 m_3b0;
};

//## Should get the following values:
//## class             DIT             NOC             CBO
//## Test3b0             0             2               3        
//## Test3b1             1             1               2
//## Test3b2             2             1               2
//## Test3b3             0             1               2
//## Test3b4             3             0               3          
//## Test3b5             0             0               2