Improve wxAny<->wxVariant conversion 64-bit integer tests

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-04-19 14:23:49 +00:00
parent 48159545de
commit fdfd64994c

View File

@@ -447,7 +447,7 @@ void wxAnyTestCase::wxVariantConversions()
wxVariant vBool((bool)true);
wxVariant vChar('A');
#ifdef wxLongLong_t
wxVariant vLongLong(wxLongLong(wxLL(0xFFFFFFFFFF)));
wxVariant vLongLong(wxLongLong(wxLL(0xAABBBBCCCC)));
wxVariant vULongLong(wxULongLong(wxULL(123456)));
#endif
wxArrayString arrstr;
@@ -514,16 +514,25 @@ void wxAnyTestCase::wxVariantConversions()
#ifdef wxLongLong_t
any = wxAny(vLongLong);
CPPUNIT_ASSERT(any == wxLL(0xFFFFFFFFFF));
CPPUNIT_ASSERT(any == wxLL(0xAABBBBCCCC));
res = any.GetAs(&variant);
CPPUNIT_ASSERT(res);
CPPUNIT_ASSERT(variant.GetLongLong() == wxLongLong(wxLL(0xFFFFFFFFFF)));
CPPUNIT_ASSERT(variant.GetType() == "longlong");
CPPUNIT_ASSERT(variant.GetLongLong() == wxLongLong(wxLL(0xAABBBBCCCC)));
#if LONG_MAX == wxINT64_MAX
// As a sanity check, test that wxVariant of type 'long' converts
// seamlessly to 'longlong' (on some 64-bit systems)
any = 0xAABBBBCCCCL;
res = any.GetAs(&variant);
CPPUNIT_ASSERT(variant.GetLongLong() == wxLongLong(wxLL(0xAABBBBCCCC)));
#endif
any = wxAny(vULongLong);
CPPUNIT_ASSERT(any == wxLL(123456));
res = any.GetAs(&variant);
CPPUNIT_ASSERT(res);
CPPUNIT_ASSERT(variant.GetType() == "ulonglong");
CPPUNIT_ASSERT(variant.GetULongLong() == wxULongLong(wxULL(123456)));
#endif