X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bec76e18352b3b0a94b0b54c8d66159722651e8b..0995b9dc18a7ce898c1c1be0e2790b258cab0fee:/tests/longlong/longlongtest.cpp diff --git a/tests/longlong/longlongtest.cpp b/tests/longlong/longlongtest.cpp index e59e8bbb48..595a86553d 100644 --- a/tests/longlong/longlongtest.cpp +++ b/tests/longlong/longlongtest.cpp @@ -69,6 +69,7 @@ private: CPPUNIT_TEST( BitOperations ); CPPUNIT_TEST( ToString ); CPPUNIT_TEST( LoHi ); + CPPUNIT_TEST( Limits ); CPPUNIT_TEST_SUITE_END(); void Conversion(); @@ -79,6 +80,7 @@ private: void BitOperations(); void ToString(); void LoHi(); + void Limits(); DECLARE_NO_COPY_CLASS(LongLongTestCase) }; @@ -86,7 +88,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( LongLongTestCase ); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( LongLongTestCase, "LongLongTestCase" ); LongLongTestCase::LongLongTestCase() @@ -237,7 +239,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(); @@ -281,7 +283,7 @@ void LongLongTestCase::ToString() for ( size_t n = 0; n < WXSIZEOF(testLongs); n++ ) { wxLongLong a = testLongs[n]; - s1 = wxString::Format(_T("%ld"), testLongs[n]); + s1 = wxString::Format(wxT("%ld"), testLongs[n]); s2 = a.ToString(); CPPUNIT_ASSERT( s1 == s2 ); @@ -303,25 +305,25 @@ void LongLongTestCase::ToString() } wxLongLong a(0x12345678, 0x87654321); - CPPUNIT_ASSERT( a.ToString() == _T("1311768467139281697") ); + CPPUNIT_ASSERT( a.ToString() == wxT("1311768467139281697") ); a.Negate(); - CPPUNIT_ASSERT( a.ToString() == _T("-1311768467139281697") ); + CPPUNIT_ASSERT( a.ToString() == wxT("-1311768467139281697") ); wxLongLong llMin(-2147483647L - 1L, 0); - CPPUNIT_ASSERT( llMin.ToString() == _T("-9223372036854775808") ); + CPPUNIT_ASSERT( llMin.ToString() == wxT("-9223372036854775808") ); #if wxUSE_LONGLONG_WX wxLongLongWx a1(a.GetHi(), a.GetLo()); - CPPUNIT_ASSERT( a1.ToString() == _T("-1311768467139281697") ); + CPPUNIT_ASSERT( a1.ToString() == wxT("-1311768467139281697") ); a1.Negate(); - CPPUNIT_ASSERT( a1.ToString() == _T("1311768467139281697") ); + CPPUNIT_ASSERT( a1.ToString() == wxT("1311768467139281697") ); #endif #if wxUSE_LONGLONG_NATIVE wxLongLongNative a2(a.GetHi(), a.GetLo()); - CPPUNIT_ASSERT( a2.ToString() == _T("-1311768467139281697") ); + CPPUNIT_ASSERT( a2.ToString() == wxT("-1311768467139281697") ); a2.Negate(); - CPPUNIT_ASSERT( a2.ToString() == _T("1311768467139281697") ); + CPPUNIT_ASSERT( a2.ToString() == wxT("1311768467139281697") ); #endif } @@ -337,4 +339,19 @@ void LongLongTestCase::LoHi() CPPUNIT_ASSERT_EQUAL( 987u, ull.GetHi() ); } +void LongLongTestCase::Limits() +{ + // VC6 doesn't specialize numeric_limits<> for __int64 so skip this test + // for it. +#ifndef __VISUALC6__ +#if wxUSE_LONGLONG_NATIVE + CPPUNIT_ASSERT( std::numeric_limits::is_specialized ); + CPPUNIT_ASSERT( std::numeric_limits::is_specialized ); + + wxULongLong maxval = std::numeric_limits::max(); + CPPUNIT_ASSERT( maxval.ToDouble() > 0 ); +#endif // wxUSE_LONGLONG_NATIVE +#endif // !__VISUALC6__ +} + #endif // wxUSE_LONGLONG