2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Eliminated randomness from the test case. Removed #ifdef 
__MINGW32
	directive.
	* test/DefaultPieceStorageTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-08-07 14:25:52 +00:00
parent fcb7254bf5
commit 4baee78941
2 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Eliminated randomness from the test case. Removed #ifdef __MINGW32
directive.
* test/DefaultPieceStorageTest.cc
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> 2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed memory leak in test code Fixed memory leak in test code

View File

@ -95,7 +95,7 @@ void DefaultPieceStorageTest::testGetMissingPiece() {
} }
void DefaultPieceStorageTest::testGetMissingFastPiece() { void DefaultPieceStorageTest::testGetMissingFastPiece() {
DefaultPieceStorage pss(btContext, option); DefaultPieceStorage pss(btContext, option, false);
pss.setEndGamePieceNum(0); pss.setEndGamePieceNum(0);
peer->setAllBitfield(); peer->setAllBitfield();
@ -118,19 +118,14 @@ void DefaultPieceStorageTest::testHasMissingPiece() {
} }
void DefaultPieceStorageTest::testCompletePiece() { void DefaultPieceStorageTest::testCompletePiece() {
DefaultPieceStorage pss(btContext, option, true); DefaultPieceStorage pss(btContext, option, false);
pss.setEndGamePieceNum(0); pss.setEndGamePieceNum(0);
peer->setAllBitfield(); peer->setAllBitfield();
SharedHandle<Piece> piece = pss.getMissingPiece(peer); SharedHandle<Piece> piece = pss.getMissingPiece(peer);
#ifdef __MINGW32__
CPPUNIT_ASSERT_EQUAL(std::string("piece: index=2, length=128"),
piece->toString());
#else // !__MINGW32__
CPPUNIT_ASSERT_EQUAL(std::string("piece: index=0, length=128"), CPPUNIT_ASSERT_EQUAL(std::string("piece: index=0, length=128"),
piece->toString()); piece->toString());
#endif // !__MINGW32__
CPPUNIT_ASSERT_EQUAL((uint64_t)0ULL, pss.getCompletedLength()); CPPUNIT_ASSERT_EQUAL((uint64_t)0ULL, pss.getCompletedLength());