]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/longlong/longlongtest.cpp
Add a wxLog::DoCreateOnDemand and call it from DoCommonPreInit so that
[wxWidgets.git] / tests / longlong / longlongtest.cpp
index f93030996a45922f13f2afd9782b761bb8771f74..e09edae668f1e99208015f93ef2a88f4edce8539 100644 (file)
@@ -24,6 +24,8 @@
 #include "wx/longlong.h"
 #include "wx/timer.h"
 
+#if wxUSE_LONGLONG
+
 // ----------------------------------------------------------------------------
 // helpers for testing
 // ----------------------------------------------------------------------------
@@ -240,30 +242,30 @@ void LongLongTestCase::BitOperations()
         for ( size_t n = 0; n < 33; n++ )
         {
             wxLongLong b(a.GetHi(), a.GetLo()), c, d = b, e;
-            d >>= n; 
-            c = b >> n; 
+            d >>= n;
+            c = b >> n;
             CPPUNIT_ASSERT( c == d );
-            d <<= n; 
-            e = c << n; 
+            d <<= n;
+            e = c << n;
             CPPUNIT_ASSERT( d == e );
 
 #if wxUSE_LONGLONG_WX
             wxLongLongWx b1(a.GetHi(), a.GetLo()), c1, d1 = b1, e1;
-            d1 >>= n; 
-            c1 = b1 >> n; 
+            d1 >>= n;
+            c1 = b1 >> n;
             CPPUNIT_ASSERT( c1 == d1 );
-            d1 <<= n; 
-            e1 = c1 << n; 
+            d1 <<= n;
+            e1 = c1 << n;
             CPPUNIT_ASSERT( d1 == e1 );
 #endif
 
 #if wxUSE_LONGLONG_NATIVE
             wxLongLongNative b2(a.GetHi(), a.GetLo()), c2, d2 = b2, e2;
-            d2 >>= n; 
-            c2 = b2 >> n; 
+            d2 >>= n;
+            c2 = b2 >> n;
             CPPUNIT_ASSERT( c2 == d2 );
-            d2 <<= n; 
-            e2 = c2 << n; 
+            d2 <<= n;
+            e2 = c2 << n;
             CPPUNIT_ASSERT( d2 == e2 );
 #endif
         }
@@ -281,6 +283,10 @@ void LongLongTestCase::ToString()
         s2 = a.ToString();
         CPPUNIT_ASSERT( s1 == s2 );
 
+        s2 = wxEmptyString;
+        s2 << a;
+        CPPUNIT_ASSERT( s1 == s2 );
+
 #if wxUSE_LONGLONG_WX
         wxLongLongWx a1 = testLongs[n];
         s2 = a1.ToString();
@@ -299,6 +305,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") );
@@ -315,3 +324,4 @@ void LongLongTestCase::ToString()
 
 }
 
+#endif // wxUSE_LONGLONG