Fix rounding issue in unittest for block calculation.

pull/1043/head
Kim Kulling 2016-10-30 11:16:31 +01:00
parent 810fc405a8
commit 337990510c
1 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,9 @@ TEST_F( IOStreamBufferTest, readlineTest ) {
TestDefaultIOStream myStream( fs, buffer ); TestDefaultIOStream myStream( fs, buffer );
size_t size( myStream.FileSize() ); size_t size( myStream.FileSize() );
size_t numBlocks( size / myBuffer.cacheSize() ); size_t numBlocks( size / myBuffer.cacheSize() );
if ( size % myBuffer.cacheSize() > 0 ) {
numBlocks++;
}
EXPECT_TRUE( myBuffer.open( &myStream ) ); EXPECT_TRUE( myBuffer.open( &myStream ) );
EXPECT_EQ( numBlocks, myBuffer.getNumBlocks() ); EXPECT_EQ( numBlocks, myBuffer.getNumBlocks() );
EXPECT_TRUE( myBuffer.close() ); EXPECT_TRUE( myBuffer.close() );