From e480a0724c4d5ee10b8e0da2f6ae398006f04d9d Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 19 Jun 2017 14:18:49 -0400 Subject: [PATCH] add test for SerialQueue::FirstSerial --- src/tests/unittests/SerialQueueTests.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/tests/unittests/SerialQueueTests.cpp b/src/tests/unittests/SerialQueueTests.cpp index d0c1504425..1819c2da56 100644 --- a/src/tests/unittests/SerialQueueTests.cpp +++ b/src/tests/unittests/SerialQueueTests.cpp @@ -117,3 +117,25 @@ TEST(SerialQueue, ClearUpTo) { } ASSERT_TRUE(expectedValues.empty()); } + +// Test FirstSerial +TEST(SerialQueue, FirstSerial) { + SerialQueue queue; + + std::vector vector1 = {1, 2, 3, 4}; + std::vector vector2 = {5, 6, 7, 8}; + std::vector vector3 = {9, 0}; + + queue.Enqueue(vector1, 0); + queue.Enqueue(std::move(vector2), 1); + queue.Enqueue(vector3, 2); + + EXPECT_EQ(queue.FirstSerial(), 0); + + queue.ClearUpTo(1); + EXPECT_EQ(queue.FirstSerial(), 2); + + queue.Clear(); + queue.Enqueue(vector1, 6); + EXPECT_EQ(queue.FirstSerial(), 6); +}