Added wxIsPod<>. Use it in wxAny instead of wxIsMovable<>.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-06-14 15:12:37 +00:00
parent 97b8472b54
commit 109e2ca434
24 changed files with 236 additions and 69 deletions

69
tests/misc/metatest.cpp Normal file
View File

@@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/misc/metatest.cpp
// Purpose: Test template meta-programming constructs
// Author: Jaakko Salli
// RCS-ID: $Id$
// Copyright: (c) the wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#include "wx/object.h"
#include "wx/meta/pod.h"
#include "wx/meta/movable.h"
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
class MetaProgrammingTestCase : public CppUnit::TestCase
{
public:
MetaProgrammingTestCase() { }
private:
CPPUNIT_TEST_SUITE( MetaProgrammingTestCase );
CPPUNIT_TEST( IsPod );
CPPUNIT_TEST( IsMovable );
CPPUNIT_TEST_SUITE_END();
void IsPod();
void IsMovable();
DECLARE_NO_COPY_CLASS(MetaProgrammingTestCase)
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( MetaProgrammingTestCase );
// also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MetaProgrammingTestCase,
"MetaProgrammingTestCase" );
void MetaProgrammingTestCase::IsPod()
{
CPPUNIT_ASSERT(wxIsPod<bool>::value);
CPPUNIT_ASSERT(wxIsPod<signed int>::value);
CPPUNIT_ASSERT(wxIsPod<double>::value);
#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)
CPPUNIT_ASSERT(wxIsPod<wxObject*>::value);
#endif
CPPUNIT_ASSERT(!wxIsPod<wxObject>::value);
}
void MetaProgrammingTestCase::IsMovable()
{
CPPUNIT_ASSERT(wxIsMovable<bool>::value);
CPPUNIT_ASSERT(wxIsMovable<signed int>::value);
CPPUNIT_ASSERT(wxIsMovable<double>::value);
#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)
CPPUNIT_ASSERT(wxIsMovable<wxObject*>::value);
#endif
CPPUNIT_ASSERT(!wxIsMovable<wxObject>::value);
}