Add wxImplicitConversionType tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -14,9 +14,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
#include "wx/meta/pod.h"
|
#include "wx/meta/pod.h"
|
||||||
#include "wx/meta/movable.h"
|
#include "wx/meta/movable.h"
|
||||||
|
|
||||||
|
#ifndef wxNO_RTTI
|
||||||
|
#include <typeinfo>
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// test class
|
// test class
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -30,10 +35,12 @@ private:
|
|||||||
CPPUNIT_TEST_SUITE( MetaProgrammingTestCase );
|
CPPUNIT_TEST_SUITE( MetaProgrammingTestCase );
|
||||||
CPPUNIT_TEST( IsPod );
|
CPPUNIT_TEST( IsPod );
|
||||||
CPPUNIT_TEST( IsMovable );
|
CPPUNIT_TEST( IsMovable );
|
||||||
|
CPPUNIT_TEST( ImplicitConversion );
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
void IsPod();
|
void IsPod();
|
||||||
void IsMovable();
|
void IsMovable();
|
||||||
|
void ImplicitConversion();
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(MetaProgrammingTestCase)
|
DECLARE_NO_COPY_CLASS(MetaProgrammingTestCase)
|
||||||
};
|
};
|
||||||
@@ -67,3 +74,21 @@ void MetaProgrammingTestCase::IsMovable()
|
|||||||
#endif
|
#endif
|
||||||
CPPUNIT_ASSERT(!wxIsMovable<wxObject>::value);
|
CPPUNIT_ASSERT(!wxIsMovable<wxObject>::value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MetaProgrammingTestCase::ImplicitConversion()
|
||||||
|
{
|
||||||
|
// wxImplicitConversionType<> is used to implement wxMax(). We test it
|
||||||
|
// indirectly through that here.
|
||||||
|
|
||||||
|
// test that wxMax(1.1,1) returns float, not long int
|
||||||
|
float f = wxMax(1.1f, 1l);
|
||||||
|
CPPUNIT_ASSERT_EQUAL( 1.1f, f);
|
||||||
|
|
||||||
|
#ifndef wxNO_RTTI
|
||||||
|
CPPUNIT_ASSERT(typeid(wxImplicitConversionType<char,int>::value) == typeid(int));
|
||||||
|
CPPUNIT_ASSERT(typeid(wxImplicitConversionType<int,unsigned>::value) == typeid(unsigned));
|
||||||
|
#ifdef wxLongLong_t
|
||||||
|
CPPUNIT_ASSERT(typeid(wxImplicitConversionType<wxLongLong_t,float>::value) == typeid(float));
|
||||||
|
#endif
|
||||||
|
#endif // !wxNO_RTTI
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user