From b68ea1821272fdd87e724b04a110c768dbaa2ea4 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Fri, 11 Feb 2022 00:20:42 -0600 Subject: [PATCH] Reduce code repetition in testcase for #1107 Signed-off-by: Michael Richters --- .../issues/1107/QueueLeaker/test/testcase.cpp | 54 +++---------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/tests/issues/1107/QueueLeaker/test/testcase.cpp b/tests/issues/1107/QueueLeaker/test/testcase.cpp index ea4b3e28..75ae1adb 100644 --- a/tests/issues/1107/QueueLeaker/test/testcase.cpp +++ b/tests/issues/1107/QueueLeaker/test/testcase.cpp @@ -45,53 +45,13 @@ class KeyAddrEventQueueLeak : public VirtualDeviceTest { }; TEST_F(KeyAddrEventQueueLeak, TimeIsConsistent) { - assertTimeElapses(1); - assertTimeElapses(1); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); - assertTimeElapses(10); + // Basic test every cycle + for (int i = 0; i < 10; ++i) + assertTimeElapses(1); + + // Guarantee underflow in case of signed integer length + for (int i = 0; i < 50; ++i) + assertTimeElapses(10); } } // namespace