Work around some unsigned->signed warnings in our tests/.
Thanks to Diego Barrios Romero <eldruin@gmail.com>.
This commit is contained in:
parent
5c996c6466
commit
f8c44a0ae4
|
@ -887,9 +887,9 @@ class MockDeathTestFactory : public DeathTestFactory {
|
||||||
// Accessors.
|
// Accessors.
|
||||||
int AssumeRoleCalls() const { return assume_role_calls_; }
|
int AssumeRoleCalls() const { return assume_role_calls_; }
|
||||||
int WaitCalls() const { return wait_calls_; }
|
int WaitCalls() const { return wait_calls_; }
|
||||||
int PassedCalls() const { return passed_args_.size(); }
|
size_t PassedCalls() const { return passed_args_.size(); }
|
||||||
bool PassedArgument(int n) const { return passed_args_[n]; }
|
bool PassedArgument(int n) const { return passed_args_[n]; }
|
||||||
int AbortCalls() const { return abort_args_.size(); }
|
size_t AbortCalls() const { return abort_args_.size(); }
|
||||||
DeathTest::AbortReason AbortArgument(int n) const {
|
DeathTest::AbortReason AbortArgument(int n) const {
|
||||||
return abort_args_[n];
|
return abort_args_[n];
|
||||||
}
|
}
|
||||||
|
@ -1050,8 +1050,8 @@ TEST_F(MacroLogicDeathTest, NothingHappens) {
|
||||||
EXPECT_FALSE(flag);
|
EXPECT_FALSE(flag);
|
||||||
EXPECT_EQ(0, factory_->AssumeRoleCalls());
|
EXPECT_EQ(0, factory_->AssumeRoleCalls());
|
||||||
EXPECT_EQ(0, factory_->WaitCalls());
|
EXPECT_EQ(0, factory_->WaitCalls());
|
||||||
EXPECT_EQ(0, factory_->PassedCalls());
|
EXPECT_EQ(0U, factory_->PassedCalls());
|
||||||
EXPECT_EQ(0, factory_->AbortCalls());
|
EXPECT_EQ(0U, factory_->AbortCalls());
|
||||||
EXPECT_FALSE(factory_->TestDeleted());
|
EXPECT_FALSE(factory_->TestDeleted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,9 +1065,9 @@ TEST_F(MacroLogicDeathTest, ChildExitsSuccessfully) {
|
||||||
EXPECT_FALSE(flag);
|
EXPECT_FALSE(flag);
|
||||||
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
||||||
EXPECT_EQ(1, factory_->WaitCalls());
|
EXPECT_EQ(1, factory_->WaitCalls());
|
||||||
ASSERT_EQ(1, factory_->PassedCalls());
|
ASSERT_EQ(1U, factory_->PassedCalls());
|
||||||
EXPECT_FALSE(factory_->PassedArgument(0));
|
EXPECT_FALSE(factory_->PassedArgument(0));
|
||||||
EXPECT_EQ(0, factory_->AbortCalls());
|
EXPECT_EQ(0U, factory_->AbortCalls());
|
||||||
EXPECT_TRUE(factory_->TestDeleted());
|
EXPECT_TRUE(factory_->TestDeleted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,9 +1080,9 @@ TEST_F(MacroLogicDeathTest, ChildExitsUnsuccessfully) {
|
||||||
EXPECT_FALSE(flag);
|
EXPECT_FALSE(flag);
|
||||||
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
||||||
EXPECT_EQ(1, factory_->WaitCalls());
|
EXPECT_EQ(1, factory_->WaitCalls());
|
||||||
ASSERT_EQ(1, factory_->PassedCalls());
|
ASSERT_EQ(1U, factory_->PassedCalls());
|
||||||
EXPECT_TRUE(factory_->PassedArgument(0));
|
EXPECT_TRUE(factory_->PassedArgument(0));
|
||||||
EXPECT_EQ(0, factory_->AbortCalls());
|
EXPECT_EQ(0U, factory_->AbortCalls());
|
||||||
EXPECT_TRUE(factory_->TestDeleted());
|
EXPECT_TRUE(factory_->TestDeleted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,8 +1096,8 @@ TEST_F(MacroLogicDeathTest, ChildPerformsReturn) {
|
||||||
EXPECT_TRUE(flag);
|
EXPECT_TRUE(flag);
|
||||||
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
||||||
EXPECT_EQ(0, factory_->WaitCalls());
|
EXPECT_EQ(0, factory_->WaitCalls());
|
||||||
EXPECT_EQ(0, factory_->PassedCalls());
|
EXPECT_EQ(0U, factory_->PassedCalls());
|
||||||
EXPECT_EQ(1, factory_->AbortCalls());
|
EXPECT_EQ(1U, factory_->AbortCalls());
|
||||||
EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
|
EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
|
||||||
factory_->AbortArgument(0));
|
factory_->AbortArgument(0));
|
||||||
EXPECT_TRUE(factory_->TestDeleted());
|
EXPECT_TRUE(factory_->TestDeleted());
|
||||||
|
@ -1112,13 +1112,13 @@ TEST_F(MacroLogicDeathTest, ChildDoesNotDie) {
|
||||||
EXPECT_TRUE(flag);
|
EXPECT_TRUE(flag);
|
||||||
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
EXPECT_EQ(1, factory_->AssumeRoleCalls());
|
||||||
EXPECT_EQ(0, factory_->WaitCalls());
|
EXPECT_EQ(0, factory_->WaitCalls());
|
||||||
EXPECT_EQ(0, factory_->PassedCalls());
|
EXPECT_EQ(0U, factory_->PassedCalls());
|
||||||
// This time there are two calls to Abort: one since the test didn't
|
// This time there are two calls to Abort: one since the test didn't
|
||||||
// die, and another from the ReturnSentinel when it's destroyed. The
|
// die, and another from the ReturnSentinel when it's destroyed. The
|
||||||
// sentinel normally isn't destroyed if a test doesn't die, since
|
// sentinel normally isn't destroyed if a test doesn't die, since
|
||||||
// _exit(2) is called in that case by ForkingDeathTest, but not by
|
// _exit(2) is called in that case by ForkingDeathTest, but not by
|
||||||
// our MockDeathTest.
|
// our MockDeathTest.
|
||||||
ASSERT_EQ(2, factory_->AbortCalls());
|
ASSERT_EQ(2U, factory_->AbortCalls());
|
||||||
EXPECT_EQ(DeathTest::TEST_DID_NOT_DIE,
|
EXPECT_EQ(DeathTest::TEST_DID_NOT_DIE,
|
||||||
factory_->AbortArgument(0));
|
factory_->AbortArgument(0));
|
||||||
EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
|
EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
|
||||||
|
|
|
@ -176,16 +176,16 @@ using ::testing::internal::EventRecordingListener;
|
||||||
|
|
||||||
void VerifyResults(const std::vector<std::string>& data,
|
void VerifyResults(const std::vector<std::string>& data,
|
||||||
const char* const* expected_data,
|
const char* const* expected_data,
|
||||||
int expected_data_size) {
|
size_t expected_data_size) {
|
||||||
const int actual_size = data.size();
|
const size_t actual_size = data.size();
|
||||||
// If the following assertion fails, a new entry will be appended to
|
// If the following assertion fails, a new entry will be appended to
|
||||||
// data. Hence we save data.size() first.
|
// data. Hence we save data.size() first.
|
||||||
EXPECT_EQ(expected_data_size, actual_size);
|
EXPECT_EQ(expected_data_size, actual_size);
|
||||||
|
|
||||||
// Compares the common prefix.
|
// Compares the common prefix.
|
||||||
const int shorter_size = expected_data_size <= actual_size ?
|
const size_t shorter_size = expected_data_size <= actual_size ?
|
||||||
expected_data_size : actual_size;
|
expected_data_size : actual_size;
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (; i < shorter_size; ++i) {
|
for (; i < shorter_size; ++i) {
|
||||||
ASSERT_STREQ(expected_data[i], data[i].c_str())
|
ASSERT_STREQ(expected_data[i], data[i].c_str())
|
||||||
<< "at position " << i;
|
<< "at position " << i;
|
||||||
|
@ -193,7 +193,8 @@ void VerifyResults(const std::vector<std::string>& data,
|
||||||
|
|
||||||
// Prints extra elements in the actual data.
|
// Prints extra elements in the actual data.
|
||||||
for (; i < actual_size; ++i) {
|
for (; i < actual_size; ++i) {
|
||||||
printf(" Actual event #%d: %s\n", i, data[i].c_str());
|
printf(" Actual event #%lu: %s\n",
|
||||||
|
static_cast<unsigned long>(i), data[i].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1219,11 +1219,11 @@ class DestructorTracker {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int GetNewIndex() {
|
static size_t GetNewIndex() {
|
||||||
DestructorCall::List().push_back(new DestructorCall);
|
DestructorCall::List().push_back(new DestructorCall);
|
||||||
return DestructorCall::List().size() - 1;
|
return DestructorCall::List().size() - 1;
|
||||||
}
|
}
|
||||||
const int index_;
|
const size_t index_;
|
||||||
|
|
||||||
GTEST_DISALLOW_ASSIGN_(DestructorTracker);
|
GTEST_DISALLOW_ASSIGN_(DestructorTracker);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user