From: Robert LeBlanc Date: Thu, 3 Mar 2016 00:34:32 +0000 (+0000) Subject: test: common/test_weighted_priority_queue Add Some More Corner Cases X-Git-Tag: v10.2.0~19^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e13a4b104bb328d4ac7bafbf744feeaa410b36cd;p=ceph.git test: common/test_weighted_priority_queue Add Some More Corner Cases Signed-off-by: Robert LeBlanc --- diff --git a/src/test/common/test_weighted_priority_queue.cc b/src/test/common/test_weighted_priority_queue.cc index d3ebc4199cfb..f94af71e97ed 100644 --- a/src/test/common/test_weighted_priority_queue.cc +++ b/src/test/common/test_weighted_priority_queue.cc @@ -206,6 +206,18 @@ struct Greater { } }; +TEST_F(WeightedPriorityQueueTest, wpq_test_remove_by_filter_null) { + WQ wq(0, 0); + LQ strictq, normq; + unsigned num_items = 100; + fill_queue(wq, strictq, normq, num_items); + // Pick a value that we didn't enqueue + const Greater pred(std::make_tuple(0, 0, 1 << 17)); + Removed wq_removed; + wq.remove_by_filter(pred, &wq_removed); + EXPECT_EQ(0u, wq_removed.size()); +} + TEST_F(WeightedPriorityQueueTest, wpq_test_remove_by_filter) { WQ wq(0, 0); LQ strictq, normq; @@ -255,6 +267,17 @@ TEST_F(WeightedPriorityQueueTest, wpq_test_remove_by_filter) { } } +TEST_F(WeightedPriorityQueueTest, wpq_test_remove_by_class_null) { + WQ wq(0, 0); + LQ strictq, normq; + unsigned num_items = 10; + fill_queue(wq, strictq, normq, num_items); + Removed wq_removed; + // Pick a klass that was not enqueued + wq.remove_by_class(klasses + 1, &wq_removed); + EXPECT_EQ(0u, wq_removed.size()); +} + TEST_F(WeightedPriorityQueueTest, wpq_test_remove_by_class) { WQ wq(0, 0); LQ strictq, normq;