Use the right new

pull/16788/head
ncteisen 7 years ago
parent 600124f84f
commit 9317845a97
  1. 22
      test/core/channel/channelz_registry_test.cc

@ -76,7 +76,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) {
channelz_channels.reserve(10);
for (int i = 0; i < 10; ++i) {
channelz_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
}
for (size_t i = 1; i < channelz_channels.size(); ++i) {
EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid())
@ -86,7 +86,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) {
TEST_F(ChannelzRegistryTest, RegisterGetTest) {
UniquePtr<BaseNode> channelz_channel(
new BaseNode(BaseNode::EntityType::kTopLevelChannel));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel));
BaseNode* retrieved = ChannelzRegistry::Get(channelz_channel->uuid());
EXPECT_EQ(channelz_channel.get(), retrieved);
}
@ -95,7 +95,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) {
std::vector<UniquePtr<BaseNode>> channelz_channels;
for (int i = 0; i < 100; i++) {
channelz_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
BaseNode* retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid());
EXPECT_EQ(channelz_channels[i].get(), retrieved);
}
@ -103,7 +103,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) {
TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) {
UniquePtr<BaseNode> channelz_channel(
new BaseNode(BaseNode::EntityType::kTopLevelChannel));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel));
// try to pull out a uuid that does not exist.
BaseNode* nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1);
EXPECT_EQ(nonexistant, nullptr);
@ -122,9 +122,9 @@ TEST_F(ChannelzRegistryTest, TestCompaction) {
odd_channels.reserve(kLoopIterations);
for (int i = 0; i < kLoopIterations; i++) {
even_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
odd_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
}
}
// without compaction, there would be exactly kLoopIterations empty slots at
@ -147,9 +147,9 @@ TEST_F(ChannelzRegistryTest, TestGetAfterCompaction) {
odd_channels.reserve(kLoopIterations);
for (int i = 0; i < kLoopIterations; i++) {
even_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
odd_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
odd_uuids.push_back(odd_channels[i]->uuid());
}
}
@ -174,9 +174,9 @@ TEST_F(ChannelzRegistryTest, TestAddAfterCompaction) {
odd_channels.reserve(kLoopIterations);
for (int i = 0; i < kLoopIterations; i++) {
even_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
odd_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
odd_uuids.push_back(odd_channels[i]->uuid());
}
}
@ -184,7 +184,7 @@ TEST_F(ChannelzRegistryTest, TestAddAfterCompaction) {
more_channels.reserve(kLoopIterations);
for (int i = 0; i < kLoopIterations; i++) {
more_channels.push_back(UniquePtr<BaseNode>(
new BaseNode(BaseNode::EntityType::kTopLevelChannel)));
New<BaseNode>(BaseNode::EntityType::kTopLevelChannel)));
BaseNode* retrieved = ChannelzRegistry::Get(more_channels[i]->uuid());
EXPECT_EQ(more_channels[i].get(), retrieved);
}

Loading…
Cancel
Save