File: VHDLEventTest.cc

package info (click to toggle)
tyvis 20031216-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,024 kB
  • ctags: 2,985
  • sloc: cpp: 22,881; sh: 8,372; makefile: 353
file content (56 lines) | stat: -rw-r--r-- 1,621 bytes parent folder | download
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
#include "VHDLEventTest.hh"
#include "tyvis/VHDLEvent.hh"

const VHDLVTime &
VHDLEventTest::getDefaultSendTime(){
  static const VHDLVTime defaultTime( 1, 1 );
  return defaultTime;
}
const VHDLVTime &
VHDLEventTest::getDefaultReceiveTime(){
  static const VHDLVTime defaultTime( 2, 2 );
  return defaultTime;
}

const string &
VHDLEventTest::getDefaultSender(){
  static const string defaultSender = "default sender";
  return defaultSender;
}

const string &
VHDLEventTest::getDefaultReceiver(){
  static const string defaultReceiver = "default receiver";
  return defaultReceiver;
}

void
VHDLEventTest::checkDefaults( const VHDLEvent *toTest ){
  CPPUNIT_ASSERT( toTest->getSendTime() == getDefaultSendTime() );
  CPPUNIT_ASSERT( toTest->getReceiveTime() == getDefaultReceiveTime() );
  CPPUNIT_ASSERT( toTest->getSender() == getDefaultSender() );
  CPPUNIT_ASSERT( toTest->getReceiver() == getDefaultReceiver() );
  
}

void 
VHDLEventTest::testConstructor( const VHDLEvent *toTest ){
  checkDefaults( toTest );
}

void 
VHDLEventTest::testSerialization( const VHDLEvent *toTest, const string &dataType ){
  checkDefaults( toTest );
  SerializedInstance *serialized = static_cast<const Serializable *>(toTest)->serialize();
  CPPUNIT_ASSERT( serialized != 0 );
  CPPUNIT_ASSERT( dataType == serialized->getDataType() );
  VHDLEvent *deserialized = dynamic_cast<VHDLEvent *>(serialized->deserialize());
  CPPUNIT_ASSERT( deserialized != 0 );
  CPPUNIT_ASSERT( deserialized != toTest );
  checkDefaults( deserialized );
}

void 
VHDLEventTest::testEventCompare( const VHDLEvent *toTest ){
  checkDefaults( toTest );
}