mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 14:28:34 +00:00
Add more tests for Common and Core/MMIO
This commit is contained in:
parent
2e70ff2441
commit
aabd524142
7 changed files with 240 additions and 0 deletions
33
Source/UnitTests/Common/FixedSizeQueueTest.cpp
Normal file
33
Source/UnitTests/Common/FixedSizeQueueTest.cpp
Normal file
|
@ -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(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());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue