aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2017-06-19 13:57:32 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2017-06-20 15:42:56 -0700
commite48949f0b44d0f8755cbbc3837a2b591867cd0bf (patch)
treede0331371464117f7f7e090309445fb4193c4c27 /test/cpp
parent070a8eeb281a2659501a60b1bbc86798fcb652c4 (diff)
Make grpc::Alarm non-copyable
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/common/alarm_cpp_test.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc
index 3e4999994a..760dd7b956 100644
--- a/test/cpp/common/alarm_cpp_test.cc
+++ b/test/cpp/common/alarm_cpp_test.cc
@@ -40,6 +40,25 @@ TEST(AlarmTest, RegularExpiry) {
EXPECT_EQ(junk, output_tag);
}
+TEST(AlarmTest, Move) {
+ CompletionQueue cq;
+ void* junk = reinterpret_cast<void*>(1618033);
+ Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk);
+ // Move constructor.
+ Alarm second(std::move(first));
+ // Moving assignment.
+ first = std::move(second);
+
+ void* output_tag;
+ bool ok;
+ const CompletionQueue::NextStatus status = cq.AsyncNext(
+ (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2));
+
+ EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
+ EXPECT_TRUE(ok);
+ EXPECT_EQ(junk, output_tag);
+}
+
TEST(AlarmTest, RegularExpiryChrono) {
CompletionQueue cq;
void* junk = reinterpret_cast<void*>(1618033);