X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d4037aa1f081ee2273468aa6f6cc5918d5e7d14..101adcd54c72f26cac85e92b28cc8564e8903d05:/tests/longlong/longlongtest.cpp?ds=sidebyside diff --git a/tests/longlong/longlongtest.cpp b/tests/longlong/longlongtest.cpp index 043a259cef..e59e8bbb48 100644 --- a/tests/longlong/longlongtest.cpp +++ b/tests/longlong/longlongtest.cpp @@ -24,6 +24,8 @@ #include "wx/longlong.h" #include "wx/timer.h" +#if wxUSE_LONGLONG + // ---------------------------------------------------------------------------- // helpers for testing // ---------------------------------------------------------------------------- @@ -66,6 +68,7 @@ private: CPPUNIT_TEST( Division ); CPPUNIT_TEST( BitOperations ); CPPUNIT_TEST( ToString ); + CPPUNIT_TEST( LoHi ); CPPUNIT_TEST_SUITE_END(); void Conversion(); @@ -75,6 +78,7 @@ private: void Division(); void BitOperations(); void ToString(); + void LoHi(); DECLARE_NO_COPY_CLASS(LongLongTestCase) }; @@ -303,8 +307,8 @@ void LongLongTestCase::ToString() a.Negate(); CPPUNIT_ASSERT( a.ToString() == _T("-1311768467139281697") ); - wxLongLong llMin(LONG_MIN, 0); - CPPUNIT_ASSERT( a.ToString() == _T("-9223372036854775808") ); + wxLongLong llMin(-2147483647L - 1L, 0); + CPPUNIT_ASSERT( llMin.ToString() == _T("-9223372036854775808") ); #if wxUSE_LONGLONG_WX wxLongLongWx a1(a.GetHi(), a.GetLo()); @@ -322,3 +326,15 @@ void LongLongTestCase::ToString() } +void LongLongTestCase::LoHi() +{ + wxLongLong ll(123, 456); + CPPUNIT_ASSERT_EQUAL( 456u, ll.GetLo() ); + CPPUNIT_ASSERT_EQUAL( 123, ll.GetHi() ); + + wxULongLong ull(987, 654); + CPPUNIT_ASSERT_EQUAL( 654u, ull.GetLo() ); + CPPUNIT_ASSERT_EQUAL( 987u, ull.GetHi() ); +} + +#endif // wxUSE_LONGLONG