Skip to content

Commit

Permalink
Make it compile on Debian/GCC 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Caio SBA committed Mar 14, 2014
1 parent 5948a66 commit b9c78d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions db/log_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ TEST(LogTest, TruncatedTrailingRecordIsIgnored) {
ShrinkSize(4); // Drop all payload as well as a header byte
ASSERT_EQ("EOF", Read());
// Truncated last record is ignored, not treated as an error
ASSERT_EQ(0, DroppedBytes());
ASSERT_EQ(0U, DroppedBytes());
ASSERT_EQ("", ReportMessage());
}

Expand All @@ -470,7 +470,7 @@ TEST(LogTest, BadLengthAtEndIsIgnored) {
Write("foo");
ShrinkSize(1);
ASSERT_EQ("EOF", Read());
ASSERT_EQ(0, DroppedBytes());
ASSERT_EQ(0U, DroppedBytes());
ASSERT_EQ("", ReportMessage());
}

Expand Down Expand Up @@ -528,7 +528,7 @@ TEST(LogTest, MissingLastIsIgnored) {
ShrinkSize(14);
ASSERT_EQ("EOF", Read());
ASSERT_EQ("", ReportMessage());
ASSERT_EQ(0, DroppedBytes());
ASSERT_EQ(0U, DroppedBytes());
}

TEST(LogTest, PartialLastIsIgnored) {
Expand All @@ -537,7 +537,7 @@ TEST(LogTest, PartialLastIsIgnored) {
ShrinkSize(1);
ASSERT_EQ("EOF", Read());
ASSERT_EQ("", ReportMessage());
ASSERT_EQ(0, DroppedBytes());
ASSERT_EQ(0U, DroppedBytes());
}

TEST(LogTest, ErrorJoinsRecords) {
Expand Down
22 changes: 11 additions & 11 deletions util/env_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ TEST(EnvPosixTest, TwoPools) {
env_->SetBackgroundThreads(kLowPoolSize);
env_->SetBackgroundThreads(kHighPoolSize, Env::Priority::HIGH);

ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));

// schedule same number of jobs in each pool
for (int i = 0; i < kJobs; i++) {
Expand All @@ -182,10 +182,10 @@ TEST(EnvPosixTest, TwoPools) {
}
// Wait a short while for the jobs to be dispatched.
Env::Default()->SleepForMicroseconds(kDelayMicros);
ASSERT_EQ(kJobs - kLowPoolSize, env_->GetThreadPoolQueueLen());
ASSERT_EQ(kJobs - kLowPoolSize,
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize), env_->GetThreadPoolQueueLen());
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(kJobs - kHighPoolSize,
ASSERT_EQ((unsigned int)(kJobs - kHighPoolSize),
env_->GetThreadPoolQueueLen(Env::Priority::HIGH));

// wait for all jobs to finish
Expand All @@ -194,8 +194,8 @@ TEST(EnvPosixTest, TwoPools) {
env_->SleepForMicroseconds(kDelayMicros);
}

ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
}

bool IsSingleVarint(const std::string& s) {
Expand Down Expand Up @@ -296,18 +296,18 @@ TEST(EnvPosixTest, AllocateTest) {

struct stat f_stat;
stat(fname.c_str(), &f_stat);
ASSERT_EQ(data.size(), f_stat.st_size);
ASSERT_EQ((unsigned int)data.size(), f_stat.st_size);
// verify that blocks are preallocated
ASSERT_EQ(kPreallocateSize / kBlockSize, f_stat.st_blocks);
ASSERT_EQ((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks);

// close the file, should deallocate the blocks
wfile.reset();

stat(fname.c_str(), &f_stat);
ASSERT_EQ(data.size(), f_stat.st_size);
ASSERT_EQ((unsigned int)data.size(), f_stat.st_size);
// verify that preallocated blocks were deallocated on file close
size_t data_blocks_pages = ((data.size() + kPageSize - 1) / kPageSize);
ASSERT_EQ(data_blocks_pages * kPageSize / kBlockSize, f_stat.st_blocks);
ASSERT_EQ((unsigned int)(data_blocks_pages * kPageSize / kBlockSize), f_stat.st_blocks);
}
#endif

Expand Down

0 comments on commit b9c78d2

Please sign in to comment.