提交 c61e16b1 编写于 作者: Q Qiao Longfei

add reader_queue_speed_test_mode_flag test

上级 8686f7c6
......@@ -221,3 +221,28 @@ TEST(BlockingQueue, MyClassTest) {
q.Receive(&b);
EXPECT_EQ(a.val_, b.val_);
}
TEST(BlockingQueue, reader_queue_speed_test_mode_flag) {
FLAGS_reader_queue_speed_test_mode = false;
size_t queue_size = 10;
BlockingQueue<size_t> q(queue_size);
for (size_t i = 0; i < queue_size; ++i) {
q.Send(i);
}
size_t b;
for (size_t i = 0; i < queue_size; ++i) {
q.Receive(&b);
EXPECT_EQ(b, i);
}
EXPECT_EQ(q.Size(), 0);
FLAGS_reader_queue_speed_test_mode = true;
for (size_t i = 0; i < queue_size; ++i) {
q.Send(i);
}
for (size_t i = 0; i < queue_size; ++i) {
q.Receive(&b);
EXPECT_EQ(b, 0);
}
EXPECT_EQ(q.Size(), queue_size);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册