From 17c51d69d12c09cf0af3baec2a8ebe3c9ec1de93 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Thu, 26 Apr 2018 11:26:25 +0800 Subject: [PATCH] fix unit test error --- .../operators/reader/reader_blocking_queue_test.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc b/paddle/fluid/operators/reader/reader_blocking_queue_test.cc index 07c22fe2bf..c0229f53f2 100644 --- a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc +++ b/paddle/fluid/operators/reader/reader_blocking_queue_test.cc @@ -28,13 +28,6 @@ TEST(BlockingQueue, CapacityTest) { EXPECT_EQ(q.Cap(), cap); } -TEST(BlockingQueue, CanSendTest) { - size_t cap = 1; - BlockingQueue q(cap); - q.Send(1); - EXPECT_FALSE(q.CanSend()); -} - void FirstInFirstOut(size_t queue_cap, size_t elem_num, size_t send_time_gap, size_t receive_time_gap) { BlockingQueue q(queue_cap); @@ -83,9 +76,11 @@ TEST(BlockingQueue, SenderBlockingTest) { sender.join(); EXPECT_EQ(send_count, queue_cap); std::vector res; - while (q.CanReceive()) { + while (true) { size_t elem; - EXPECT_TRUE(q.Receive(&elem)); + if (!q.Receive(&elem) { + break; + } res.push_back(elem); } EXPECT_EQ(res.size(), queue_cap); -- GitLab