mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Add more tests for Common and Core/MMIO
This commit is contained in:
@ -23,6 +23,15 @@ TEST(UniqueID, UniqueEnough)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(IsMMIOAddress, SpecialAddresses)
|
||||
{
|
||||
// WG Pipe address, should not be handled by MMIO.
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xCC008000));
|
||||
|
||||
// Memory zone used by games using the "MMU Speedhack".
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xE0000000));
|
||||
}
|
||||
|
||||
class MappingTest : public testing::Test
|
||||
{
|
||||
protected:
|
||||
@ -75,3 +84,27 @@ TEST_F(MappingTest, ReadWriteDirect)
|
||||
val32 += 1; m_mapping->Write(0xCC001234, val32);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MappingTest, ReadWriteComplex)
|
||||
{
|
||||
bool read_called = false, write_called = false;
|
||||
|
||||
m_mapping->Register(0xCC001234,
|
||||
MMIO::ComplexRead<u8>([&read_called](u32 addr) {
|
||||
EXPECT_EQ(0xCC001234, addr);
|
||||
read_called = true;
|
||||
return 0x12;
|
||||
}),
|
||||
MMIO::ComplexWrite<u8>([&write_called](u32 addr, u8 val) {
|
||||
EXPECT_EQ(0xCC001234, addr);
|
||||
EXPECT_EQ(0x34, val);
|
||||
write_called = true;
|
||||
})
|
||||
);
|
||||
|
||||
u8 val; m_mapping->Read(0xCC001234, &val); EXPECT_EQ(0x12, val);
|
||||
m_mapping->Write(0xCC001234, (u8)0x34);
|
||||
|
||||
EXPECT_TRUE(read_called);
|
||||
EXPECT_TRUE(write_called);
|
||||
}
|
||||
|
Reference in New Issue
Block a user