summaryrefslogtreecommitdiff
path: root/maximus/sci/src/SciMsgTest.cpp
blob: 4673fc6725d70d2e4cb7389180a71a21b0c7ee35 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "SciMsgTest.h"

#include "SystemManager.h"

#include "Error.h"

#include <iostream>
using namespace std;

CPPUNIT_TEST_SUITE_REGISTRATION (SciMsgTest);


void SciMsgTest::setUp (void)
{
  clog << "SciMsgTest::setUp" << endl;
  
  try
  {
    clog << "\tSciMsgTest -> SciServer()" << endl;
    mpSciServer = new SciServer();
    clog << "\tSciMsgTest -> FunctionCallManager(SciServer*)" << endl;
    mpFunctionCallManager = new FunctionCallManager(mpSciServer);
    clog << "\tSciMsgTest -> FunctionSciMsg(FunctionCallManager*)" << endl;
    mpFunctionSciMsg = new FunctionSciMsg (mpFunctionCallManager);
    clog << "\tSciMsgTest -> ClockSciMsg()" << endl;
  	mpClockSciMsg = new ClockSciMsg ();
    clog << "\tSciMsgTest -> PhySciMsg()" << endl;
    mpPhySciMsg = new PhySciMsg ();
    mpSystemManager = new SystemManager(mpSciServer);
    clog << "\tSciMsgTest -> SystemSciMsg()" << endl;
    mpSystemSciMsg = new SystemSciMsg(mpSystemManager);
  }
  catch ( Error &e ) 
  {
    clog << "\tSciMsgTest -> Error::display" << endl;
    e.display();
    CPPUNIT_FAIL ( "setUp failed" );
  }
}


void SciMsgTest::tearDown (void) 
{
  clog << "SciMsgTest::tearDown" << endl;
  
  if (NULL != mpSciServer)
  {
    clog << "\tSciMsgTest -> ~SciServer" << endl;
    delete mpSciServer;
    mpSciServer = NULL;
  }
  if (NULL != mpFunctionCallManager)
  {
    clog << "\tSciMsgTest -> ~FunctionCallManager" << endl;
    delete mpFunctionCallManager;
    mpFunctionCallManager = NULL; 
  }
  if (NULL != mpFunctionSciMsg)
  {
    clog << "\tSciMsgTest -> ~FunctionSciMsg" << endl;
    delete mpFunctionSciMsg;
    mpFunctionSciMsg = NULL;
  }
  if (NULL != mpClockSciMsg)
  {
    clog << "\tSciMsgTest -> ~ClockSciMsg" << endl;
    delete mpClockSciMsg;
    mpClockSciMsg = NULL;
  }
  if (NULL != mpPhySciMsg)
  {
    clog << "\tSciMsgTest -> ~PhySciMsg" << endl;
    delete mpPhySciMsg;
    mpPhySciMsg = NULL;
  }
  if (NULL != mpSystemSciMsg)
  {
    clog << "\tSciMsgTest -> ~SystemSciMsg" << endl;
    delete mpSystemSciMsg;
    mpSystemSciMsg = NULL;
  }
}


void SciMsgTest::simpleTest (void)
{
  clog << endl;
  clog << "-------------------------------------------------------------------------------------" << endl;
	clog << "SciMsgTest::simpleTest" << endl;
  
  if (  (NULL == mpClockSciMsg)
        || (NULL == mpFunctionSciMsg)
        || (NULL == mpPhySciMsg)
        || (NULL == mpSystemSciMsg) )
  {
    CPPUNIT_FAIL ( "At least one of the initialized SciMsg pointers is NULL" );
  }
  
  clog << "-------------------------------------------------------------------------------------" << endl;
  clog << endl;
}