From aabd524142625647fdad84ecf2401ba6cadfcfa6 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 9 Mar 2014 14:27:04 +0100 Subject: Add more tests for Common and Core/MMIO --- Source/UnitTests/Common/FixedSizeQueueTest.cpp | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Source/UnitTests/Common/FixedSizeQueueTest.cpp (limited to 'Source/UnitTests/Common/FixedSizeQueueTest.cpp') diff --git a/Source/UnitTests/Common/FixedSizeQueueTest.cpp b/Source/UnitTests/Common/FixedSizeQueueTest.cpp new file mode 100644 index 0000000000..484dc64419 --- /dev/null +++ b/Source/UnitTests/Common/FixedSizeQueueTest.cpp @@ -0,0 +1,33 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include + +#include "Common/FixedSizeQueue.h" + +TEST(FixedSizeQueue, Simple) +{ + FixedSizeQueue q; + + EXPECT_EQ(0, q.size()); + + q.push(0); + q.push(1); + q.push(2); + q.push(3); + q.push(4); + for (int i = 0; i < 1000; ++i) + { + EXPECT_EQ(i, q.front()); + EXPECT_EQ(i, q.pop_front()); + q.push(i + 5); + } + EXPECT_EQ(1000, q.pop_front()); + EXPECT_EQ(1001, q.pop_front()); + EXPECT_EQ(1002, q.pop_front()); + EXPECT_EQ(1003, q.pop_front()); + EXPECT_EQ(1004, q.pop_front()); + + EXPECT_EQ(0, q.size()); +} -- cgit v1.2.3 From 46becfc06b3a8b91d0500a8ee226c85b4450dddf Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 15 Mar 2014 03:30:59 +0100 Subject: Tests: fix signed/unsigned comparison warning --- Source/UnitTests/Common/FixedSizeQueueTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/UnitTests/Common/FixedSizeQueueTest.cpp') diff --git a/Source/UnitTests/Common/FixedSizeQueueTest.cpp b/Source/UnitTests/Common/FixedSizeQueueTest.cpp index 484dc64419..d77f3645f0 100644 --- a/Source/UnitTests/Common/FixedSizeQueueTest.cpp +++ b/Source/UnitTests/Common/FixedSizeQueueTest.cpp @@ -10,7 +10,7 @@ TEST(FixedSizeQueue, Simple) { FixedSizeQueue q; - EXPECT_EQ(0, q.size()); + EXPECT_EQ(0u, q.size()); q.push(0); q.push(1); @@ -29,5 +29,5 @@ TEST(FixedSizeQueue, Simple) EXPECT_EQ(1003, q.pop_front()); EXPECT_EQ(1004, q.pop_front()); - EXPECT_EQ(0, q.size()); + EXPECT_EQ(0u, q.size()); } -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/UnitTests/Common/FixedSizeQueueTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/UnitTests/Common/FixedSizeQueueTest.cpp') diff --git a/Source/UnitTests/Common/FixedSizeQueueTest.cpp b/Source/UnitTests/Common/FixedSizeQueueTest.cpp index d77f3645f0..370eb0e7e7 100644 --- a/Source/UnitTests/Common/FixedSizeQueueTest.cpp +++ b/Source/UnitTests/Common/FixedSizeQueueTest.cpp @@ -1,5 +1,5 @@ // Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. #include -- cgit v1.2.3