summaryrefslogtreecommitdiff
path: root/cesar/maximus/phy/src/PhySciMsgNoiseTest.cpp
blob: 521e0feef9e0f2a16ebbf04abb4cb271659813cd (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
#include "PhySciMsgNoiseTest.h"

#include "PhySciMsgNoise.h"
#include "PhyProcessor.h"
#include "SciServer.h"

#include "Logger.h"

// for 'getpid()'
#include <sys/types.h>
#include <unistd.h>

using namespace std;


CPPUNIT_TEST_SUITE_REGISTRATION (PhySciMsgNoiseTest);


void PhySciMsgNoiseTest::setUp (void)
{
  logTest();

  mpSci = new SciServer();
  mpPhy = new PhyProcessor(mpSci);
  mpPhySciMsgNoise = new PhySciMsgNoise(mpPhy);
  CPPUNIT_ASSERT_MESSAGE ( "creation failed",
                           (mpPhy == mpPhySciMsgNoise->getPhyProcessor())
                           && (NULL != mpPhySciMsgNoise)
                           && (PHY_TYPE_NOISE == mpPhySciMsgNoise->getSpecializedSciMsgType()) );
}


void PhySciMsgNoiseTest::tearDown (void) 
{
  logTest();

  if (NULL != mpPhySciMsgNoise)
  {
    delete (mpPhySciMsgNoise);
    mpPhySciMsgNoise = NULL;
  }
  if (NULL != mpPhy)
  {
    delete (mpPhy);
    mpPhy = NULL;
  }
  if (NULL != mpSci)
  {
    delete (mpSci);
    mpSci = NULL;
  }
}


void PhySciMsgNoiseTest::prepareTest (void)
{
  logTest();

  CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
                           (mpPhySciMsgNoise->prepare())
                           && (PHY_FLAG_CRC_OK == mpPhySciMsgNoise->getFlags()) );
}