OpenWalnut  1.5.0dev
WPersonalInformation_test.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WPERSONALINFORMATION_TEST_H
26 #define WPERSONALINFORMATION_TEST_H
27 
28 #include <cxxtest/TestSuite.h>
29 
30 #include "../WPersonalInformation.h"
31 
32 /**
33  * Tests for WPersonalInformation
34  */
35 class WPersonalInformationTest : public CxxTest::TestSuite
36 {
37 public:
38  /**
39  * Test creation
40  */
41  void testCreation( void )
42  {
43  // The following would not compile: WPersonalInformation info;
45  }
46 
47  /**
48  * Test setting subjectID
49  */
50  void testSetSubjectID( void )
51  {
53  info.setSubjectID( 4711 );
54  TS_ASSERT_EQUALS( 4711, info.m_subjectID );
55  }
56 
57  /**
58  * Test getting subjectID
59  */
60  void testGetSubjectID( void )
61  {
63  info.m_subjectID = 4711;
64  TS_ASSERT_EQUALS( 4711, info.getSubjectID() );
65  }
66 
67  /**
68  * Test equality operator
69  */
70  void testEquality( void )
71  {
73  info.m_subjectID = 4711;
74  info.m_lastName = "hallo";
76  info2.m_subjectID = 4711;
77  info2.m_lastName = "hallo";
78  TS_ASSERT_EQUALS( info == info2, true );
79  info2.m_lastName = "hallo2";
80  TS_ASSERT_EQUALS( info == info2, false );
81  }
82 
83  /**
84  * Test inequality operator
85  */
86  void testInequality( void )
87  {
89  info.m_subjectID = 4711;
90  info.m_lastName = "hallo";
92  info2.m_subjectID = 4711;
93  info2.m_lastName = "hallo2";
94  TS_ASSERT_EQUALS( info != info2, true );
95  info2.m_lastName = "hallo";
96  TS_ASSERT_EQUALS( info != info2, false );
97  }
98 };
99 
100 #endif // WPERSONALINFORMATION_TEST_H
Tests for WPersonalInformation.
void testGetSubjectID(void)
Test getting subjectID.
void testSetSubjectID(void)
Test setting subjectID.
void testInequality(void)
Test inequality operator.
void testEquality(void)
Test equality operator.
void testCreation(void)
Test creation.
A structure that holds all relevant information about the subject.
uint64_t m_subjectID
Represents a globally unique identifier.
static WPersonalInformation createDummyInformation()
Returns an empty dummy WPersonalInformation object.
std::string m_lastName
Last name or family of the person.