- if ( ws )
- {
- CPPUNIT_ASSERT( wbuf.data() );
- CPPUNIT_ASSERT( wx_wcscmp(wbuf, ws) == 0 );
- }
- else // conversion is supposed to fail
- {
- CPPUNIT_ASSERT_EQUAL( (wchar_t *)NULL, wbuf.data() );
- }
- }
+ CPPUNIT_ASSERT( memcmp(theBuffer.data(), "The\0String",
+ lenNulString + 1) == 0 );
+
+ wxString szTheString2("The\0String", wxConvLocal, lenNulString);
+ CPPUNIT_ASSERT_EQUAL( lenNulString, szTheString2.length() );
+ CPPUNIT_ASSERT( wxTmemcmp(szTheString2.c_str(), L"The\0String",
+ lenNulString + 1) == 0 );
+#else // !wxUSE_UNICODE
+ wxString szTheString("TheString");
+ szTheString.insert(3, 1, '\0');
+ wxWCharBuffer theBuffer = szTheString.wc_str(wxConvLibc);
+
+ CPPUNIT_ASSERT( memcmp(theBuffer.data(), L"The\0String", 11 * sizeof(wchar_t)) == 0 );
+
+ wxString szLocalTheString("TheString");
+ szLocalTheString.insert(3, 1, '\0');
+ wxWCharBuffer theLocalBuffer = szLocalTheString.wc_str(wxConvLocal);
+
+ CPPUNIT_ASSERT( memcmp(theLocalBuffer.data(), L"The\0String", 11 * sizeof(wchar_t)) == 0 );