Use CPPUNIT_ASSERT_EQUAL

Change-Id: Id4305098e3139bb21711fefb350fa2574e3638cd
This commit is contained in:
Stephan Bergmann
2015-09-15 13:22:03 +02:00
parent 6781d85afc
commit 23a0d1ff82

View File

@@ -30,25 +30,25 @@ void decode(const OUString& rIn, const OUString &rOut)
rtlCipherError result = rtl_cipher_init(cipher, rtl_Cipher_DirectionDecode, aKey, SAL_N_ELEMENTS(aKey), 0, 0);
CPPUNIT_ASSERT_MESSAGE("cipher init failed", result == rtl_Cipher_E_None);
CPPUNIT_ASSERT_EQUAL_MESSAGE("cipher init failed", rtl_Cipher_E_None, result);
osl::File aIn(rIn);
CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.open(osl_File_OpenFlag_Read));
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aIn.open(osl_File_OpenFlag_Read));
osl::File aOut(rOut);
CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.open(osl_File_OpenFlag_Write));
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aOut.open(osl_File_OpenFlag_Write));
sal_uInt8 in[8192];
sal_uInt8 out[8192];
sal_uInt64 nBytesRead, nBytesWritten;
while(true)
{
CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.read(in, sizeof(in), nBytesRead));
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aIn.read(in, sizeof(in), nBytesRead));
if (!nBytesRead)
break;
CPPUNIT_ASSERT(rtl_Cipher_E_None == rtl_cipher_decode(cipher, in, nBytesRead, out, sizeof(out)));
CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.write(out, nBytesRead, nBytesWritten));
CPPUNIT_ASSERT(nBytesRead == nBytesWritten);
CPPUNIT_ASSERT_EQUAL(rtl_Cipher_E_None, rtl_cipher_decode(cipher, in, nBytesRead, out, sizeof(out)));
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aOut.write(out, nBytesRead, nBytesWritten));
CPPUNIT_ASSERT_EQUAL(nBytesRead, nBytesWritten);
}
rtl_cipher_destroy(cipher);
@@ -61,7 +61,7 @@ void FiltersTest::recursiveScan(filterStatus nExpected,
{
osl::Directory aDir(rURL);
CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open());
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aDir.open());
osl::DirectoryItem aItem;
osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
std::set<OUString> dirs;
@@ -111,7 +111,7 @@ void FiltersTest::recursiveScan(filterStatus nExpected,
OUString realUrl;
if (bEncrypted)
{
CPPUNIT_ASSERT(osl::FileBase::E_None == osl::FileBase::createTempFile(NULL, NULL, &sTmpFile));
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, osl::FileBase::createTempFile(NULL, NULL, &sTmpFile));
decode(sURL, sTmpFile);
realUrl = sTmpFile;
}
@@ -141,9 +141,9 @@ void FiltersTest::recursiveScan(filterStatus nExpected,
if (nExpected == test::indeterminate)
continue;
filterStatus nResult = bRes ? test::pass : test::fail;
CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), nResult == nExpected);
CPPUNIT_ASSERT_EQUAL_MESSAGE(aRes.getStr(), nExpected, nResult);
}
CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aDir.close());
}
void FiltersTest::testDir(const OUString &rFilter,