diff options
| author | Jules Blok <jules.blok@gmail.com> | 2015-06-10 00:00:12 +0200 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2015-06-10 00:00:12 +0200 |
| commit | 7dfced21a2e5aac7195e0e1ad76468e30306766b (patch) | |
| tree | bd671b639d3d911460b767caabad8fc8a759a6bf /Source/UnitTests/Common/FixedSizeQueueTest.cpp | |
| parent | c25be031fc1031d795157d8344b87b7841145197 (diff) | |
| parent | 7b0a65e295c784f9d573f2ef52d4e2a7b9bb2889 (diff) | |
Merge branch 'master' into stable
Diffstat (limited to 'Source/UnitTests/Common/FixedSizeQueueTest.cpp')
| -rw-r--r-- | Source/UnitTests/Common/FixedSizeQueueTest.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Source/UnitTests/Common/FixedSizeQueueTest.cpp b/Source/UnitTests/Common/FixedSizeQueueTest.cpp new file mode 100644 index 0000000000..370eb0e7e7 --- /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 <gtest/gtest.h> + +#include "Common/FixedSizeQueue.h" + +TEST(FixedSizeQueue, Simple) +{ + FixedSizeQueue<int, 5> q; + + EXPECT_EQ(0u, 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(0u, q.size()); +} |
