From ab1ff6b0415a3582b7aee26e19e738928c75e0d3 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 28 Jun 2017 14:14:24 -0700 Subject: Split move test --- test/cpp/common/alarm_cpp_test.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc index 760dd7b956..ce4168843c 100644 --- a/test/cpp/common/alarm_cpp_test.cc +++ b/test/cpp/common/alarm_cpp_test.cc @@ -40,13 +40,25 @@ TEST(AlarmTest, RegularExpiry) { EXPECT_EQ(junk, output_tag); } -TEST(AlarmTest, Move) { +TEST(AlarmTest, MoveConstructor) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first(&cq, grpc_timeout_seconds_to_deadline(1), junk); + Alarm second(std::move(first)); + 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, MoveAssignment) { CompletionQueue cq; void* junk = reinterpret_cast(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; -- cgit v1.2.3