X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c1ce4db1dea14fb8afa70b9e826647d21b354145..0d2cd276ccd1107e4d91514959b762d334633634:/tests/mbconv/mbconvtest.cpp diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index d816bc855f..49baef19d3 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -213,6 +213,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( MBConvTestCase ); // also include in it's own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConvTestCase" ); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConv" ); void MBConvTestCase::WC2CP1250() { @@ -241,7 +242,9 @@ void MBConvTestCase::WC2CP1250() } } -// print an unsigned character array as a C unsigned character array +// Print an unsigned character array as a C unsigned character array. +// NB: Please don't remove this function even though it's not used anywhere, +// it's very useful when debugging a failed test. wxString CByteArrayFormat( const void* data, size_t len, const wxChar* name ) { const unsigned char* bytes = (unsigned char*)data; @@ -971,14 +974,16 @@ void MBConvTestCase::TestEncoder( // make sure the characters generated are correct CPPUNIT_ASSERT( 0 == memcmp( outputBuffer, multiBuffer, multiBytes ) ); + size_t i; + // the output buffer should be null terminated - for ( size_t i = multiBytes; i < multiBytes + sizeofNull; i++ ) + for ( i = multiBytes; i < multiBytes + sizeofNull; i++ ) { CPPUNIT_ASSERT( ((unsigned char*)outputBuffer.data())[i] == 0 ); } // make sure the rest of the output buffer is untouched - for ( size_t i = multiBytes + sizeofNull; i < outputBufferSize; i++ ) + for ( i = multiBytes + sizeofNull; i < outputBufferSize; i++ ) { CPPUNIT_ASSERT( ((unsigned char*)outputBuffer.data())[i] == UNINITIALIZED ); } @@ -1035,10 +1040,10 @@ void MBConvTestCase::TestStreamEncoder( { textOutputStream.PutChar( wideBuffer[i] ); } - CPPUNIT_ASSERT( memoryOutputStream.TellO() == multiBytes ); + CPPUNIT_ASSERT_EQUAL( (wxFileOffset)multiBytes, memoryOutputStream.TellO() ); wxCharBuffer copy( memoryOutputStream.TellO() ); memoryOutputStream.CopyTo( copy.data(), memoryOutputStream.TellO()); - CPPUNIT_ASSERT( 0 == memcmp( copy.data(), multiBuffer, multiBytes ) ); + CPPUNIT_ASSERT_EQUAL( 0, memcmp( copy.data(), multiBuffer, multiBytes ) ); } #endif