]>
git.saurik.com Git - wxWidgets.git/blob - tests/misc/metatest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/misc/metatest.cpp
3 // Purpose: Test template meta-programming constructs
4 // Author: Jaakko Salli
6 // Copyright: (c) the wxWidgets team
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
16 #include "wx/object.h"
17 #include "wx/meta/pod.h"
18 #include "wx/meta/movable.h"
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
24 class MetaProgrammingTestCase
: public CppUnit::TestCase
27 MetaProgrammingTestCase() { }
30 CPPUNIT_TEST_SUITE( MetaProgrammingTestCase
);
31 CPPUNIT_TEST( IsPod
);
32 CPPUNIT_TEST( IsMovable
);
33 CPPUNIT_TEST_SUITE_END();
38 DECLARE_NO_COPY_CLASS(MetaProgrammingTestCase
)
41 // register in the unnamed registry so that these tests are run by default
42 CPPUNIT_TEST_SUITE_REGISTRATION( MetaProgrammingTestCase
);
44 // also include in it's own registry so that these tests can be run alone
45 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MetaProgrammingTestCase
,
46 "MetaProgrammingTestCase" );
49 void MetaProgrammingTestCase::IsPod()
51 CPPUNIT_ASSERT(wxIsPod
<bool>::value
);
52 CPPUNIT_ASSERT(wxIsPod
<signed int>::value
);
53 CPPUNIT_ASSERT(wxIsPod
<double>::value
);
54 #if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)
55 CPPUNIT_ASSERT(wxIsPod
<wxObject
*>::value
);
57 CPPUNIT_ASSERT(!wxIsPod
<wxObject
>::value
);
60 void MetaProgrammingTestCase::IsMovable()
62 CPPUNIT_ASSERT(wxIsMovable
<bool>::value
);
63 CPPUNIT_ASSERT(wxIsMovable
<signed int>::value
);
64 CPPUNIT_ASSERT(wxIsMovable
<double>::value
);
65 #if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)
66 CPPUNIT_ASSERT(wxIsMovable
<wxObject
*>::value
);
68 CPPUNIT_ASSERT(!wxIsMovable
<wxObject
>::value
);