]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: tests/misc/metatest.cpp | |
3 | // Purpose: Test template meta-programming constructs | |
4 | // Author: Jaakko Salli | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) the wxWidgets team | |
7 | // Licence: wxWindows licence | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #include "testprec.h" | |
11 | ||
12 | #ifdef __BORLANDC__ | |
13 | # pragma hdrstop | |
14 | #endif | |
15 | ||
16 | #include "wx/object.h" | |
17 | #include "wx/meta/pod.h" | |
18 | #include "wx/meta/movable.h" | |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // test class | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
24 | class MetaProgrammingTestCase : public CppUnit::TestCase | |
25 | { | |
26 | public: | |
27 | MetaProgrammingTestCase() { } | |
28 | ||
29 | private: | |
30 | CPPUNIT_TEST_SUITE( MetaProgrammingTestCase ); | |
31 | CPPUNIT_TEST( IsPod ); | |
32 | CPPUNIT_TEST( IsMovable ); | |
33 | CPPUNIT_TEST_SUITE_END(); | |
34 | ||
35 | void IsPod(); | |
36 | void IsMovable(); | |
37 | ||
38 | DECLARE_NO_COPY_CLASS(MetaProgrammingTestCase) | |
39 | }; | |
40 | ||
41 | // register in the unnamed registry so that these tests are run by default | |
42 | CPPUNIT_TEST_SUITE_REGISTRATION( MetaProgrammingTestCase ); | |
43 | ||
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" ); | |
47 | ||
48 | ||
49 | void MetaProgrammingTestCase::IsPod() | |
50 | { | |
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); | |
56 | #endif | |
57 | CPPUNIT_ASSERT(!wxIsPod<wxObject>::value); | |
58 | } | |
59 | ||
60 | void MetaProgrammingTestCase::IsMovable() | |
61 | { | |
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); | |
67 | #endif | |
68 | CPPUNIT_ASSERT(!wxIsMovable<wxObject>::value); | |
69 | } |