OpenWalnut  1.4.0
WPersonalInformation_test.h
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #ifndef WPERSONALINFORMATION_TEST_H
00026 #define WPERSONALINFORMATION_TEST_H
00027 
00028 #include <cxxtest/TestSuite.h>
00029 
00030 #include "../WPersonalInformation.h"
00031 
00032 /**
00033  * Tests for WPersonalInformation
00034  */
00035 class WPersonalInformationTest : public CxxTest::TestSuite
00036 {
00037 public:
00038     /**
00039      * Test creation
00040      */
00041     void testCreation( void )
00042     {
00043         // The following would not compile: WPersonalInformation info;
00044         WPersonalInformation info( WPersonalInformation::createDummyInformation() );
00045     }
00046 
00047     /**
00048      * Test setting subjectID
00049      */
00050     void testSetSubjectID( void )
00051     {
00052         WPersonalInformation info( WPersonalInformation::createDummyInformation() );
00053         info.setSubjectID( 4711 );
00054         TS_ASSERT_EQUALS( 4711, info.m_subjectID );
00055     }
00056 
00057     /**
00058      * Test getting subjectID
00059      */
00060     void testGetSubjectID( void )
00061     {
00062         WPersonalInformation info( WPersonalInformation::createDummyInformation() );
00063         info.m_subjectID = 4711;
00064         TS_ASSERT_EQUALS( 4711, info.getSubjectID() );
00065     }
00066 
00067     /**
00068      * Test equality operator
00069      */
00070     void testEquality( void )
00071     {
00072         WPersonalInformation info( WPersonalInformation::createDummyInformation() );
00073         info.m_subjectID = 4711;
00074         info.m_lastName = "hallo";
00075         WPersonalInformation info2( WPersonalInformation::createDummyInformation() );
00076         info2.m_subjectID = 4711;
00077         info2.m_lastName = "hallo";
00078         TS_ASSERT_EQUALS( info == info2, true );
00079         info2.m_lastName = "hallo2";
00080         TS_ASSERT_EQUALS( info == info2, false );
00081     }
00082 
00083     /**
00084      * Test inequality operator
00085      */
00086     void testInequality( void )
00087     {
00088         WPersonalInformation info( WPersonalInformation::createDummyInformation() );
00089         info.m_subjectID = 4711;
00090         info.m_lastName = "hallo";
00091         WPersonalInformation info2( WPersonalInformation::createDummyInformation() );
00092         info2.m_subjectID = 4711;
00093         info2.m_lastName = "hallo2";
00094         TS_ASSERT_EQUALS( info != info2, true );
00095         info2.m_lastName = "hallo";
00096         TS_ASSERT_EQUALS( info != info2, false );
00097     }
00098 };
00099 
00100 #endif  // WPERSONALINFORMATION_TEST_H