Kaydet (Commit) a0ab0c79 authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_tools_test: fix loplugin:cppunitassertequals warnings

Change-Id: I6738b6b5159403f1654b401a27f08fc829521e73
üst ff3d175e
...@@ -46,11 +46,11 @@ namespace ...@@ -46,11 +46,11 @@ namespace
char std_a(78); char std_a(78);
iss >> std_a; iss >> std_a;
CPPUNIT_ASSERT(std_a == 'f'); CPPUNIT_ASSERT_EQUAL('f', std_a);
char tools_a(78); char tools_a(78);
aMemStream.ReadChar( tools_a ); aMemStream.ReadChar( tools_a );
CPPUNIT_ASSERT(tools_a == 'f'); CPPUNIT_ASSERT_EQUAL('f', tools_a);
iss.seekg(0, std::ios_base::end); iss.seekg(0, std::ios_base::end);
//seeking to end doesn't set eof, reading past eof does //seeking to end doesn't set eof, reading past eof does
...@@ -67,19 +67,19 @@ namespace ...@@ -67,19 +67,19 @@ namespace
//so, now eof is set //so, now eof is set
CPPUNIT_ASSERT(iss.eof()); CPPUNIT_ASSERT(iss.eof());
//a failed read doesn't change the data, it remains unchanged //a failed read doesn't change the data, it remains unchanged
CPPUNIT_ASSERT(std_a == 78); CPPUNIT_ASSERT_EQUAL(static_cast<char>(78), std_a);
//nothing wrong with the stream, so not bad //nothing wrong with the stream, so not bad
CPPUNIT_ASSERT(!iss.bad()); CPPUNIT_ASSERT(!iss.bad());
//yet, the read didn't succeed //yet, the read didn't succeed
CPPUNIT_ASSERT(!iss.good()); CPPUNIT_ASSERT(!iss.good());
CPPUNIT_ASSERT(iss.rdstate() == (std::ios::failbit|std::ios::eofbit)); CPPUNIT_ASSERT_EQUAL((std::ios::failbit|std::ios::eofbit), iss.rdstate());
tools_a = 78; tools_a = 78;
aMemStream.ReadChar( tools_a ); aMemStream.ReadChar( tools_a );
//so, now eof is set //so, now eof is set
CPPUNIT_ASSERT(aMemStream.eof()); CPPUNIT_ASSERT(aMemStream.eof());
//a failed read doesn't change the data, it remains unchanged //a failed read doesn't change the data, it remains unchanged
CPPUNIT_ASSERT(tools_a == 78); CPPUNIT_ASSERT_EQUAL(static_cast<char>(78), tools_a);
//nothing wrong with the stream, so not bad //nothing wrong with the stream, so not bad
CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.bad());
//yet, the read didn't succeed //yet, the read didn't succeed
...@@ -95,18 +95,18 @@ namespace ...@@ -95,18 +95,18 @@ namespace
aMemStream.ReadUInt16( tools_b ); aMemStream.ReadUInt16( tools_b );
CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(aMemStream.eof()); CPPUNIT_ASSERT(aMemStream.eof());
CPPUNIT_ASSERT(tools_b == 0x1122); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(0x1122), tools_b);
iss.clear(); iss.clear();
iss.seekg(0); iss.seekg(0);
CPPUNIT_ASSERT(iss.good()); CPPUNIT_ASSERT(iss.good());
iss >> std_a; iss >> std_a;
CPPUNIT_ASSERT(std_a == 'f'); CPPUNIT_ASSERT_EQUAL('f', std_a);
aMemStream.Seek(0); aMemStream.Seek(0);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
aMemStream.ReadChar( tools_a ); aMemStream.ReadChar( tools_a );
CPPUNIT_ASSERT(tools_a == 'f'); CPPUNIT_ASSERT_EQUAL('f', tools_a);
//failbit is rather subtle wrt e.g seeks //failbit is rather subtle wrt e.g seeks
...@@ -116,7 +116,7 @@ namespace ...@@ -116,7 +116,7 @@ namespace
iss.seekg(0); iss.seekg(0);
CPPUNIT_ASSERT(iss.good()); CPPUNIT_ASSERT(iss.good());
iss.read(buffer, sizeof(buffer)); iss.read(buffer, sizeof(buffer));
CPPUNIT_ASSERT(iss.gcount() == 3); CPPUNIT_ASSERT_EQUAL(static_cast<std::streamsize>(3), iss.gcount());
CPPUNIT_ASSERT(!iss.good()); CPPUNIT_ASSERT(!iss.good());
CPPUNIT_ASSERT(!iss.bad()); CPPUNIT_ASSERT(!iss.bad());
CPPUNIT_ASSERT(iss.eof()); CPPUNIT_ASSERT(iss.eof());
...@@ -124,7 +124,7 @@ namespace ...@@ -124,7 +124,7 @@ namespace
aMemStream.Seek(0); aMemStream.Seek(0);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
std::size_t nRet = aMemStream.ReadBytes(buffer, sizeof(buffer)); std::size_t nRet = aMemStream.ReadBytes(buffer, sizeof(buffer));
CPPUNIT_ASSERT(nRet == 3); CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(3), nRet);
CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(aMemStream.eof()); CPPUNIT_ASSERT(aMemStream.eof());
...@@ -136,10 +136,10 @@ namespace ...@@ -136,10 +136,10 @@ namespace
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ); SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
OString aOne = read_uInt8s_ToOString(aMemStream, 3); OString aOne = read_uInt8s_ToOString(aMemStream, 3);
CPPUNIT_ASSERT(aOne == "foo"); CPPUNIT_ASSERT_EQUAL(OString("foo"), aOne);
OString aTwo = read_uInt8s_ToOString(aMemStream, 3); OString aTwo = read_uInt8s_ToOString(aMemStream, 3);
CPPUNIT_ASSERT(aTwo == "bar"); CPPUNIT_ASSERT_EQUAL(OString("bar"), aTwo);
OString aThree = read_uInt8s_ToOString(aMemStream, 3); OString aThree = read_uInt8s_ToOString(aMemStream, 3);
CPPUNIT_ASSERT(aThree.isEmpty()); CPPUNIT_ASSERT(aThree.isEmpty());
...@@ -147,7 +147,7 @@ namespace ...@@ -147,7 +147,7 @@ namespace
aMemStream.Seek(0); aMemStream.Seek(0);
OString aFour = read_uInt8s_ToOString(aMemStream, 100); OString aFour = read_uInt8s_ToOString(aMemStream, 100);
CPPUNIT_ASSERT(aFour == foo); CPPUNIT_ASSERT_EQUAL(OString(foo), aFour);
} }
void Test::test_read_cstring() void Test::test_read_cstring()
...@@ -156,7 +156,7 @@ namespace ...@@ -156,7 +156,7 @@ namespace
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ); SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream); OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT(aOne == "foobar"); CPPUNIT_ASSERT_EQUAL(OString("foobar"), aOne);
CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(aMemStream.eof()); CPPUNIT_ASSERT(aMemStream.eof());
...@@ -164,7 +164,7 @@ namespace ...@@ -164,7 +164,7 @@ namespace
aMemStream.Seek(0); aMemStream.Seek(0);
foo[3] = 0; foo[3] = 0;
OString aTwo = read_zeroTerminated_uInt8s_ToOString(aMemStream); OString aTwo = read_zeroTerminated_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT(aTwo == "foo"); CPPUNIT_ASSERT_EQUAL(OString("foo"), aTwo);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
} }
...@@ -174,7 +174,7 @@ namespace ...@@ -174,7 +174,7 @@ namespace
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ); SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
OString aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream); OString aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT(aFoo == "foo"); CPPUNIT_ASSERT_EQUAL(OString("foo"), aFoo);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(!aMemStream.eof()); CPPUNIT_ASSERT(!aMemStream.eof());
...@@ -182,7 +182,7 @@ namespace ...@@ -182,7 +182,7 @@ namespace
aMemStream.Seek(0); aMemStream.Seek(0);
foo[0] = 10; foo[0] = 10;
aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream); aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT(aFoo == "foobar"); CPPUNIT_ASSERT_EQUAL(OString("foobar"), aFoo);
CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(aMemStream.eof()); CPPUNIT_ASSERT(aMemStream.eof());
...@@ -192,7 +192,7 @@ namespace ...@@ -192,7 +192,7 @@ namespace
foo[0] = 0; foo[0] = 0;
foo[1] = 3; foo[1] = 3;
aFoo = read_uInt16_lenPrefixed_uInt8s_ToOString(aMemStream); aFoo = read_uInt16_lenPrefixed_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT(aFoo == "oob"); CPPUNIT_ASSERT_EQUAL(OString("oob"), aFoo);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(!aMemStream.eof()); CPPUNIT_ASSERT(!aMemStream.eof());
...@@ -208,12 +208,12 @@ namespace ...@@ -208,12 +208,12 @@ namespace
bRet = aMemStream.ReadLine(aFoo); bRet = aMemStream.ReadLine(aFoo);
CPPUNIT_ASSERT(bRet); CPPUNIT_ASSERT(bRet);
CPPUNIT_ASSERT(aFoo == "foo"); CPPUNIT_ASSERT_EQUAL(OString("foo"), aFoo);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
bRet = aMemStream.ReadLine(aFoo); bRet = aMemStream.ReadLine(aFoo);
CPPUNIT_ASSERT(bRet); CPPUNIT_ASSERT(bRet);
CPPUNIT_ASSERT(aFoo == "bar"); CPPUNIT_ASSERT_EQUAL(OString("bar"), aFoo);
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
bRet = aMemStream.ReadLine(aFoo); bRet = aMemStream.ReadLine(aFoo);
...@@ -263,12 +263,12 @@ namespace ...@@ -263,12 +263,12 @@ namespace
SvMemoryStream aMemStreamB(bar, SAL_N_ELEMENTS(bar)-1, StreamMode::READ); SvMemoryStream aMemStreamB(bar, SAL_N_ELEMENTS(bar)-1, StreamMode::READ);
bRet = aMemStreamB.ReadLine(aFoo); bRet = aMemStreamB.ReadLine(aFoo);
CPPUNIT_ASSERT(bRet); CPPUNIT_ASSERT(bRet);
CPPUNIT_ASSERT(aFoo == "foo"); CPPUNIT_ASSERT_EQUAL(OString("foo"), aFoo);
CPPUNIT_ASSERT(!aMemStreamB.eof()); //<-- diff A CPPUNIT_ASSERT(!aMemStreamB.eof()); //<-- diff A
std::istringstream issB(bar, std::istringstream::in); std::istringstream issB(bar, std::istringstream::in);
std::getline(issB, sStr, '\n'); std::getline(issB, sStr, '\n');
CPPUNIT_ASSERT(sStr == "foo"); CPPUNIT_ASSERT_EQUAL(std::string("foo"), sStr);
CPPUNIT_ASSERT(issB.eof()); //<-- diff A CPPUNIT_ASSERT(issB.eof()); //<-- diff A
} }
......
...@@ -49,23 +49,23 @@ namespace tools_urlobj ...@@ -49,23 +49,23 @@ namespace tools_urlobj
{ {
INetURLObject aUrl( OUString( "file://10.10.1.1/sampledir/sample.file" ) ); INetURLObject aUrl( OUString( "file://10.10.1.1/sampledir/sample.file" ) );
#ifdef LINUX #ifdef LINUX
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("smb://10.10.1.1/sampledir/sample.file"),
== "smb://10.10.1.1/sampledir/sample.file" ); aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT_EQUAL(INetProtocol::Smb, aUrl.GetProtocol());
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE )
== "file://10.10.1.1/sampledir/sample.file" ); == "file://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("10.10.1.1"),
== "10.10.1.1" ); aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("/sampledir/sample.file"),
== "/sampledir/sample.file" ); aUrl.GetURLPath(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.getName( ) CPPUNIT_ASSERT_EQUAL(OUString("sample.file"),
== "sample.file" ); aUrl.getName());
CPPUNIT_ASSERT( aUrl.getBase( ) == "sample" ); CPPUNIT_ASSERT_EQUAL(OUString("sample"), aUrl.getBase());
CPPUNIT_ASSERT( aUrl.getExtension( ) == "file" ); CPPUNIT_ASSERT_EQUAL(OUString("file"), aUrl.getExtension());
} }
void urlobjTest_002( ) void urlobjTest_002( )
...@@ -75,22 +75,22 @@ namespace tools_urlobj ...@@ -75,22 +75,22 @@ namespace tools_urlobj
setFSysPath( "\\\\137.65.170.24\\c$\\Img0001.jpg", setFSysPath( "\\\\137.65.170.24\\c$\\Img0001.jpg",
FSysStyle::Detect ); FSysStyle::Detect );
#ifdef LINUX #ifdef LINUX
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("smb://137.65.170.24/c$/Img0001.jpg"),
== "smb://137.65.170.24/c$/Img0001.jpg" ); aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT_EQUAL(INetProtocol::Smb, aUrl.GetProtocol());
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE )
== "file://137.65.170.24/c$/Img0001.jpg" ); == "file://137.65.170.24/c$/Img0001.jpg" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("137.65.170.24"),
== "137.65.170.24" ); aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("/c$/Img0001.jpg"),
== "/c$/Img0001.jpg" ); aUrl.GetURLPath(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.getName( ) == "Img0001.jpg" ); CPPUNIT_ASSERT_EQUAL(OUString("Img0001.jpg"), aUrl.getName());
CPPUNIT_ASSERT( aUrl.getBase( ) == "Img0001" ); CPPUNIT_ASSERT_EQUAL(OUString("Img0001"), aUrl.getBase());
CPPUNIT_ASSERT( aUrl.getExtension( ) == "jpg" ); CPPUNIT_ASSERT_EQUAL(OUString("jpg"), aUrl.getExtension());
} }
...@@ -101,41 +101,41 @@ namespace tools_urlobj ...@@ -101,41 +101,41 @@ namespace tools_urlobj
setFSysPath( "\\\\hive-winxp-x86\\pmladek\\test2.odt", setFSysPath( "\\\\hive-winxp-x86\\pmladek\\test2.odt",
FSysStyle::Detect ); FSysStyle::Detect );
#ifdef LINUX #ifdef LINUX
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("smb://hive-winxp-x86/pmladek/test2.odt"),
== "smb://hive-winxp-x86/pmladek/test2.odt" ); aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT_EQUAL(INetProtocol::Smb, aUrl.GetProtocol());
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE )
== "file://hive-winxp-x86/pmladek/test2.odt" ); == "file://hive-winxp-x86/pmladek/test2.odt" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("hive-winxp-x86"),
== "hive-winxp-x86" ); aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("/pmladek/test2.odt"),
== "/pmladek/test2.odt" ); aUrl.GetURLPath(INetURLObject::DecodeMechanism::NONE));
} }
void urlobjTest_004( ) void urlobjTest_004( )
{ {
INetURLObject aUrl( OUString( "smb://10.10.1.1/sampledir/sample.file" ) ); INetURLObject aUrl( OUString( "smb://10.10.1.1/sampledir/sample.file" ) );
#ifdef LINUX #ifdef LINUX
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("smb://10.10.1.1/sampledir/sample.file"),
== "smb://10.10.1.1/sampledir/sample.file" ); aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT_EQUAL( INetProtocol::Smb, aUrl.GetProtocol( ) );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE )
== "file://10.10.1.1/sampledir/sample.file" ); == "file://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("10.10.1.1"),
== "10.10.1.1" ); aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("/sampledir/sample.file"),
== "/sampledir/sample.file" ); aUrl.GetURLPath(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.getName( ) == "sample.file" ); CPPUNIT_ASSERT_EQUAL(OUString("sample.file"), aUrl.getName());
CPPUNIT_ASSERT( aUrl.getBase( ) == "sample" ); CPPUNIT_ASSERT_EQUAL(OUString("sample"), aUrl.getBase());
CPPUNIT_ASSERT( aUrl.getExtension( ) == "file" ); CPPUNIT_ASSERT_EQUAL(OUString("file"), aUrl.getExtension());
} }
void urlobjTest_005( ) void urlobjTest_005( )
...@@ -144,22 +144,22 @@ namespace tools_urlobj ...@@ -144,22 +144,22 @@ namespace tools_urlobj
aUrl.setFSysPath( "//137.65.170.24/c$/Img0001.jpg", aUrl.setFSysPath( "//137.65.170.24/c$/Img0001.jpg",
FSysStyle::Detect ); FSysStyle::Detect );
#ifdef LINUX #ifdef LINUX
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("smb://137.65.170.24/c$/Img0001.jpg"),
== "smb://137.65.170.24/c$/Img0001.jpg" ); aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT_EQUAL(INetProtocol::Smb, aUrl.GetProtocol());
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE )
== "file://137.65.170.24/c$/Img0001.jpg" ); == "file://137.65.170.24/c$/Img0001.jpg" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("137.65.170.24"),
== "137.65.170.24" ); aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("/c$/Img0001.jpg"),
== "/c$/Img0001.jpg" ); aUrl.GetURLPath(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.getName( ) == "Img0001.jpg" ); CPPUNIT_ASSERT_EQUAL(OUString("Img0001.jpg"), aUrl.getName( ));
CPPUNIT_ASSERT( aUrl.getBase( ) == "Img0001" ); CPPUNIT_ASSERT_EQUAL(OUString("Img0001"), aUrl.getBase( ));
CPPUNIT_ASSERT( aUrl.getExtension( ) == "jpg" ); CPPUNIT_ASSERT_EQUAL(OUString("jpg"), aUrl.getExtension( ));
} }
...@@ -169,19 +169,19 @@ namespace tools_urlobj ...@@ -169,19 +169,19 @@ namespace tools_urlobj
aUrl.setFSysPath( "//hive-winxp-x86/pmladek/test2.odt", aUrl.setFSysPath( "//hive-winxp-x86/pmladek/test2.odt",
FSysStyle::Detect ); FSysStyle::Detect );
#ifdef LINUX #ifdef LINUX
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("smb://hive-winxp-x86/pmladek/test2.odt"),
== "smb://hive-winxp-x86/pmladek/test2.odt" ); aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT_EQUAL(INetProtocol::Smb, aUrl.GetProtocol());
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::DecodeMechanism::NONE )
== "file://hive-winxp-x86/pmladek/test2.odt" ); == "file://hive-winxp-x86/pmladek/test2.odt" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("hive-winxp-x86"),
== "hive-winxp-x86" ); aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE ) CPPUNIT_ASSERT_EQUAL(OUString("/pmladek/test2.odt"),
== "/pmladek/test2.odt" ); aUrl.GetURLPath( INetURLObject::DecodeMechanism::NONE));
} }
void urlobjCmisTest( ) void urlobjCmisTest( )
...@@ -239,7 +239,7 @@ namespace tools_urlobj ...@@ -239,7 +239,7 @@ namespace tools_urlobj
url = INetURLObject("data:"); url = INetURLObject("data:");
//TODO: CPPUNIT_ASSERT(url.HasError()); //TODO: CPPUNIT_ASSERT(url.HasError());
strm = url.getData(); strm = url.getData();
CPPUNIT_ASSERT(strm == nullptr); CPPUNIT_ASSERT(!strm);
url = INetURLObject("data:,"); url = INetURLObject("data:,");
CPPUNIT_ASSERT(!url.HasError()); CPPUNIT_ASSERT(!url.HasError());
...@@ -263,7 +263,7 @@ namespace tools_urlobj ...@@ -263,7 +263,7 @@ namespace tools_urlobj
url = INetURLObject("data:base64,"); url = INetURLObject("data:base64,");
//TODO: CPPUNIT_ASSERT(url.HasError()); //TODO: CPPUNIT_ASSERT(url.HasError());
strm = url.getData(); strm = url.getData();
CPPUNIT_ASSERT(strm == nullptr); CPPUNIT_ASSERT(!strm);
url = INetURLObject("data:;base64,"); url = INetURLObject("data:;base64,");
CPPUNIT_ASSERT(!url.HasError()); CPPUNIT_ASSERT(!url.HasError());
...@@ -294,12 +294,12 @@ namespace tools_urlobj ...@@ -294,12 +294,12 @@ namespace tools_urlobj
url = INetURLObject("data:;base64,YWJjCg="); url = INetURLObject("data:;base64,YWJjCg=");
CPPUNIT_ASSERT(!url.HasError()); CPPUNIT_ASSERT(!url.HasError());
strm = url.getData(); strm = url.getData();
CPPUNIT_ASSERT(strm == nullptr); CPPUNIT_ASSERT(!strm);
url = INetURLObject("data:;base64,YWJ$Cg=="); url = INetURLObject("data:;base64,YWJ$Cg==");
CPPUNIT_ASSERT(!url.HasError()); CPPUNIT_ASSERT(!url.HasError());
strm = url.getData(); strm = url.getData();
CPPUNIT_ASSERT(strm == nullptr); CPPUNIT_ASSERT(!strm);
url = INetURLObject("data:text/plain;param=%22;base64,%22,YQ=="); url = INetURLObject("data:text/plain;param=%22;base64,%22,YQ==");
CPPUNIT_ASSERT(!url.HasError()); CPPUNIT_ASSERT(!url.HasError());
...@@ -316,7 +316,7 @@ namespace tools_urlobj ...@@ -316,7 +316,7 @@ namespace tools_urlobj
url = INetURLObject("http://example.com"); url = INetURLObject("http://example.com");
CPPUNIT_ASSERT(!url.HasError()); CPPUNIT_ASSERT(!url.HasError());
strm = url.getData(); strm = url.getData();
CPPUNIT_ASSERT(strm == nullptr); CPPUNIT_ASSERT(!strm);
} }
void urlobjTest_isSchemeEqualTo() { void urlobjTest_isSchemeEqualTo() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment