aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/common
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-01-12 16:24:55 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-01-21 21:04:37 -0800
commit28b6a446376b6545debe385c271de81c50c8867f (patch)
treeccde0c040709a16e7c6da6b59453844a02f226cc /test/cpp/common
parent2b226adf60eac113e6c2780aa551c775e72511d6 (diff)
Migrate all remaining features of core test to C++ layer test
Diffstat (limited to 'test/cpp/common')
-rw-r--r--test/cpp/common/alarm_test.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/cpp/common/alarm_test.cc b/test/cpp/common/alarm_test.cc
index 7adc3102f4..2a933a84c4 100644
--- a/test/cpp/common/alarm_test.cc
+++ b/test/cpp/common/alarm_test.cc
@@ -182,6 +182,29 @@ TEST(AlarmTest, Cancellation) {
EXPECT_EQ(junk, output_tag);
}
+TEST(AlarmTest, SetDestruction) {
+ CompletionQueue cq;
+ void* junk = reinterpret_cast<void*>(1618033);
+ {
+ Alarm alarm;
+ alarm.Set(&cq, grpc_timeout_seconds_to_deadline(2), junk);
+ }
+
+ void* output_tag;
+ bool ok;
+ const CompletionQueue::NextStatus status = cq.AsyncNext(
+ (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1));
+
+ EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
+ EXPECT_FALSE(ok);
+ EXPECT_EQ(junk, output_tag);
+}
+
+TEST(AlarmTest, UnsetDestruction) {
+ CompletionQueue cq;
+ Alarm alarm;
+}
+
} // namespace
} // namespace grpc