X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/51496782d13dd083fd20f9db31418b9231f2e5c3..e48df5d353610b4b2d91c5dbb4ffdf97f1aa4253:/tests/longlong/longlongtest.cpp diff --git a/tests/longlong/longlongtest.cpp b/tests/longlong/longlongtest.cpp index 5b7920bf87..a9142a6fb5 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) }; @@ -233,7 +237,7 @@ void LongLongTestCase::Division() void LongLongTestCase::BitOperations() { - for ( size_t n = 0; n < ITEMS; n++ ) + for ( size_t m = 0; m < ITEMS; m++ ) { wxLongLong a = RAND_LL(); @@ -303,6 +307,9 @@ void LongLongTestCase::ToString() a.Negate(); CPPUNIT_ASSERT( a.ToString() == _T("-1311768467139281697") ); + wxLongLong llMin(-2147483647L - 1L, 0); + CPPUNIT_ASSERT( llMin.ToString() == _T("-9223372036854775808") ); + #if wxUSE_LONGLONG_WX wxLongLongWx a1(a.GetHi(), a.GetLo()); CPPUNIT_ASSERT( a1.ToString() == _T("-1311768467139281697") ); @@ -319,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