This commit is contained in:
Clément Le Bihan
2020-02-11 16:15:07 +01:00
16 changed files with 572 additions and 91 deletions
+53 -2
View File
@@ -45,9 +45,30 @@ Test(BusAccessor, GetWramEnd)
Test(BusAccessor, GetWramMirror)
{
auto pair = Init();
std::shared_ptr<Memory::MemoryShadow> accessor = nullptr;
std::shared_ptr<Memory::RectangleShadow> accessor = nullptr;
accessor = std::static_pointer_cast<Memory::MemoryShadow>(pair.first->getAccessor(0x2F11FF));
accessor = std::static_pointer_cast<Memory::RectangleShadow>(pair.first->getAccessor(0x2F11FF));
cr_assert_neq(accessor, nullptr);
cr_assert_eq(accessor->_initial.get(), pair.second.wram.get());
}
Test(BusAccessor, GetWramMirror2)
{
auto pair = Init();
std::shared_ptr<Memory::RectangleShadow> accessor = nullptr;
accessor = std::static_pointer_cast<Memory::RectangleShadow>(pair.first->getAccessor(0x100000));
cr_assert_neq(accessor, nullptr);
cr_assert_eq(accessor->_initial.get(), pair.second.wram.get());
}
Test(BusAccessor, GetWramMirror3)
{
auto pair = Init();
std::shared_ptr<Memory::RectangleShadow> accessor = nullptr;
accessor = std::static_pointer_cast<Memory::RectangleShadow>(pair.first->getAccessor(0x1010));
cr_assert_neq(accessor, nullptr);
cr_assert_eq(accessor->_initial.get(), pair.second.wram.get());
}
@@ -123,6 +144,15 @@ Test(BusAccessor, GetAPUMirror)
cr_assert_eq(accessor->_initial.get(), pair.second.apu.get());
}
Test(BusAccessor, GetAPUMirrorFirstHalf)
{
auto pair = Init();
std::shared_ptr<Memory::MemoryShadow> accessor = nullptr;
accessor = std::static_pointer_cast<Memory::MemoryShadow>(pair.first->getAccessor(0x052143));
cr_assert_eq(accessor->_initial.get(), pair.second.apu.get());
}
Test(BusAccessor, GetCPUStart)
{
auto pair = Init();
@@ -337,6 +367,27 @@ Test(BusRead, ReadWRAM)
cr_assert_eq(data, 123);
}
Test(BusRead, ReadWRAM2)
{
auto pair = Init();
uint8_t data;
pair.second.wram->_data[0x1010] = 123;
data = pair.first->read(0x7E1010);
cr_assert_eq(data, 123);
}
Test(BusRead, ReadWRAMMirror)
{
auto pair = Init();
uint8_t data;
pair.second.wram->_data[0x1010] = 123;
data = pair.first->read(0x1010);
cr_assert_eq(data, 123);
}
////////////////////////////
// //
// MemoryBus::write tests //