wxWidgets/tests/misc/typeinfotest.cpp
Vadim Zeitlin 3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00

92 lines
2.2 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: tests/misc/typeinfotest.cpp
// Purpose: Test typeinfo.h
// Author: Jaakko Salli
// Copyright: (c) the wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#include "wx/typeinfo.h"
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
class TypeInfoTestCase : public CppUnit::TestCase
{
public:
TypeInfoTestCase() { }
private:
CPPUNIT_TEST_SUITE( TypeInfoTestCase );
CPPUNIT_TEST( Test );
CPPUNIT_TEST_SUITE_END();
void Test();
DECLARE_NO_COPY_CLASS(TypeInfoTestCase)
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( TypeInfoTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TypeInfoTestCase, "TypeInfoTestCase" );
namespace UserNameSpace {
class UserType1
{
WX_DECLARE_TYPEINFO_INLINE(UserType1)
public:
virtual ~UserType1() { }
};
}
class UserType1
{
WX_DECLARE_TYPEINFO_INLINE(UserType1)
public:
virtual ~UserType1() { }
};
class UserType2
{
WX_DECLARE_TYPEINFO(UserType2)
public:
virtual ~UserType2() { }
};
WX_DEFINE_TYPEINFO(UserType2)
void TypeInfoTestCase::Test()
{
UserNameSpace::UserType1 uns_ut1;
UserNameSpace::UserType1* uns_ut1_p = new UserNameSpace::UserType1();
UserType1 ut1;
UserType1* ut1_p = new UserType1();
UserType2 ut2;
UserType2* ut2_p = new UserType2();
// These type comparison should match
CPPUNIT_ASSERT(wxTypeId(uns_ut1) == wxTypeId(*uns_ut1_p));
CPPUNIT_ASSERT(wxTypeId(ut1) == wxTypeId(*ut1_p));
CPPUNIT_ASSERT(wxTypeId(ut2) == wxTypeId(*ut2_p));
// These type comparison should not match
CPPUNIT_ASSERT(wxTypeId(uns_ut1) != wxTypeId(ut1));
CPPUNIT_ASSERT(wxTypeId(uns_ut1) != wxTypeId(ut2));
CPPUNIT_ASSERT(wxTypeId(ut1) != wxTypeId(ut2));
delete uns_ut1_p;
delete ut1_p;
delete ut2_p;
}