2023-08-28 23:08:19 +02:00
|
|
|
#include "doctest.h"
|
2023-08-29 23:11:31 +02:00
|
|
|
|
|
|
|
#include <memory/ram.h>
|
2023-08-28 23:08:19 +02:00
|
|
|
|
|
|
|
TEST_SUITE_BEGIN("memory/ram");
|
|
|
|
|
|
|
|
TEST_CASE("byte order for 16-byte write is correct")
|
|
|
|
{
|
|
|
|
RAM r(0x10);
|
|
|
|
r.write16(0x0,0xAA55);
|
|
|
|
CHECK(r.read8(0x0) == 0x55);
|
|
|
|
CHECK(r.read8(0x1) == 0xAA);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("byte order for 16-byte write is correct")
|
|
|
|
{
|
|
|
|
RAM r(0x10);
|
|
|
|
r.write8(0x0, 0x55);
|
|
|
|
r.write8(0x1, 0xAA);
|
|
|
|
|
|
|
|
CHECK(r.read16(0x0) == 0xAA55);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("can be read only")
|
|
|
|
{
|
|
|
|
u8 data[1] = { 0x00 };
|
|
|
|
RAM r(data, 1, true);
|
|
|
|
|
|
|
|
r.write8(0,0x10);
|
|
|
|
CHECK(r.read8(0) == 0x00);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_SUITE_END();
|