Fixing tests compilations

This commit is contained in:
Zoe Roux
2021-07-04 03:14:01 +02:00
parent 9a36eded32
commit f78903d2d9
21 changed files with 2565 additions and 2703 deletions
+11 -11
View File
@@ -4,7 +4,7 @@
#include <catch2/catch.hpp>
#include "tests.hpp"
#include "../sources/Memory/RectangleShadow.hpp"
#include "Memory/RectangleShadow.hpp"
using namespace ComSquare;
@@ -46,11 +46,11 @@ TEST_CASE("DualLineRamRead RectangleMemory", "[RectangleMemory]")
TEST_CASE("HorizontalRamShadowRead RectangleMemory", "[RectangleMemory]")
{
std::shared_ptr<Ram::Ram> ram = std::make_shared<Ram::Ram>(0xFF, Component::Rom, "Rom");
ram->setMemoryRegion(0x00, 0xFF, 0x0000, 0x0000);
Ram::Ram ram(0xFF, Component::Rom, "Rom");
ram.setMemoryRegion(0x00, 0xFF, 0x0000, 0x0000);
Memory::RectangleShadow shadow(ram, 0x00, 0xFF, 0x8000, 0x8000);
for (int i = 0x00; i < 0xFF; i++)
ram->_data[i] = i;
ram._data[i] = i;
for (uint24_t i = 0x008000; i < 0xFF8000; i += 0x010000) {
uint8_t v = shadow.read(shadow.getRelativeAddress(i));
REQUIRE(v == i >> 16u);
@@ -58,11 +58,11 @@ TEST_CASE("HorizontalRamShadowRead RectangleMemory", "[RectangleMemory]")
TEST_CASE("HorizontalRamShadowReadWithBankOffset RectangleMemory", "[RectangleMemory]")
{
std::shared_ptr<Ram::Ram> ram = std::make_shared<Ram::Ram>(0xFF, Component::Rom, "Rom");
ram->setMemoryRegion(0x00, 0xFF, 0x0000, 0x0000);
Ram::Ram ram(0xFF, Component::Rom, "Rom");
ram.setMemoryRegion(0x00, 0xFF, 0x0000, 0x0000);
Memory::RectangleShadow shadow(ram, 0x80, 0xFF, 0x8000, 0x8000);
for (int i = 0x00; i < 0xFF; i++)
ram->_data[i] = i;
ram._data[i] = i;
shadow.setBankOffset(0x80);
for (uint24_t i = 0x808000; i < 0xFF8000; i += 0x010000) {
uint8_t v = shadow.read(shadow.getRelativeAddress(i));
@@ -72,17 +72,17 @@ TEST_CASE("HorizontalRamShadowReadWithBankOffset RectangleMemory", "[RectangleMe
TEST_CASE("ShadowOffsetCartridge RectangleMemory", "[RectangleMemory]")
{
std::shared_ptr<Ram::Ram> ram = std::make_shared<Ram::Ram>(0x3fff80, Component::Rom, "Rom");
ram->setMemoryRegion(0x80, 0xFF, 0x8000, 0xFFFF);
Ram::Ram ram(0x3fff80, Component::Rom, "Rom");
ram.setMemoryRegion(0x80, 0xFF, 0x8000, 0xFFFF);
Memory::RectangleShadow shadow(ram, 0xC0, 0xEF, 0x0000, 0x7FFF);
for (int i = 0x00; i < 0x3fff80; i++)
ram->_data[i] = i;
ram._data[i] = i;
shadow.setBankOffset(0x40);
for (uint24_t i = 0xC00000; i <= 0xEF7FFF; i += 0x1) {
if ((uint16_t)i > 0x7FFFu)
i += 0x010000 - 0x8000;
uint8_t v = shadow.read(shadow.getRelativeAddress(i));
uint8_t r = ram->read(ram->getRelativeAddress(i + 0x8000));
uint8_t r = ram.read(ram.getRelativeAddress(i + 0x8000));
REQUIRE(v == r);
}
}