From fdfd64994ced7d2f96e12ab629cf10931b9a991e Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Mon, 19 Apr 2010 14:23:49 +0000 Subject: [PATCH] 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 --- tests/any/anytest.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/any/anytest.cpp b/tests/any/anytest.cpp index 35e5852..d405b5c 100644 --- a/tests/any/anytest.cpp +++ b/tests/any/anytest.cpp @@ -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 -- 2.7.4