]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/strings/strings.cpp
added code showing that at least under Windows wxCombobox::GetSelection() return...
[wxWidgets.git] / tests / strings / strings.cpp
index 3ff5fde7ece59e9b9cdf1e692bc785a82fa4a93a..c62abad45d30c8f88cca6d62ada880aa619b5d31 100644 (file)
@@ -222,6 +222,21 @@ void StringTestCase::Conversion()
 #endif
 }
 
+// in case wcscmp is missing
+//
+static int wx_wcscmp(const wchar_t *s1, const wchar_t *s2)
+{
+    for (;;) {
+        if (*s1 != *s2)
+            return *s1 - *s2;
+        if (*s1 == 0)
+            break;
+        s1++;
+        s2++;
+    }
+    return 0;
+}
+
 void
 StringTestCase::DoTestConversion(const char *s,
                                  const wchar_t *ws,
@@ -240,7 +255,7 @@ StringTestCase::DoTestConversion(const char *s,
         wxWCharBuffer wbuf(wxString(s).wc_str(conv));
 
         if ( ws )
-            CPPUNIT_ASSERT( wcscmp(wbuf, ws) == 0 );
+            CPPUNIT_ASSERT( wx_wcscmp(wbuf, ws) == 0 );
         else
             CPPUNIT_ASSERT( !*wbuf );
     }
@@ -476,8 +491,11 @@ void StringTestCase::Replace()
             CPPUNIT_ASSERT( s == wxString(r,rlen) ); \
         }
     
-    TEST_WXREPLACE( _T("null\0char"), 9, _T("c"), _T("d"), true,
-                          _T("null\0dhar"), 9 );   
+    TEST_WXREPLACE( _T("null\0char"), 9, _T("c"), _T("de"), true,
+                          _T("null\0dehar"), 10 );   
+
+    TEST_WXREPLACE( _T("null\0dehar"), 10, _T("de"), _T("c"), true,
+                          _T("null\0char"), 9 );   
 
     #undef TEST_WXREPLACE
     #undef TEST_NULLCHARREPLACE