Use intptr_ts for channel registry test

reviewable/pr16020/r5
ncteisen 6 years ago
parent 2c990387c7
commit 891cf34004
  1. 9
      test/core/channel/channelz_registry_test.cc

@ -67,14 +67,16 @@ TEST(ChannelzRegistryTest, UuidsAreIncreasing) {
}
TEST(ChannelzRegistryTest, RegisterGetTest) {
ChannelNode* channelz_channel = nullptr;
// we hackily jam an intptr_t into this pointer to check for equality later
ChannelNode* channelz_channel = (ChannelNode*)42;
intptr_t uuid = ChannelzRegistry::RegisterChannelNode(channelz_channel);
ChannelNode* retrieved = ChannelzRegistry::GetChannelNode(uuid);
EXPECT_EQ(channelz_channel, retrieved);
}
TEST(ChannelzRegistryTest, RegisterManyItems) {
ChannelNode* channelz_channel = nullptr;
// we hackily jam an intptr_t into this pointer to check for equality later
ChannelNode* channelz_channel = (ChannelNode*)42;
for (int i = 0; i < 100; i++) {
intptr_t uuid = ChannelzRegistry::RegisterChannelNode(channelz_channel);
ChannelNode* retrieved = ChannelzRegistry::GetChannelNode(uuid);
@ -83,7 +85,8 @@ TEST(ChannelzRegistryTest, RegisterManyItems) {
}
TEST(ChannelzRegistryTest, NullIfNotPresentTest) {
ChannelNode* channelz_channel = nullptr;
// we hackily jam an intptr_t into this pointer to check for equality later
ChannelNode* channelz_channel = (ChannelNode*)42;
intptr_t uuid = ChannelzRegistry::RegisterChannelNode(channelz_channel);
// try to pull out a uuid that does not exist.
ChannelNode* nonexistant = ChannelzRegistry::GetChannelNode(uuid + 1);

Loading…
Cancel
Save