backend-infra-engineer: Pre-0.2.2 2024 Q2 snapshot
This commit is contained in:
@@ -16,9 +16,9 @@ add_executable(
|
||||
emu/cpu_test.cc
|
||||
emu/spc700_test.cc
|
||||
emu/ppu_test.cc
|
||||
compression_test.cc
|
||||
snes_palette_test.cc
|
||||
room_object_test.cc
|
||||
gfx/compression_test.cc
|
||||
gfx/snes_palette_test.cc
|
||||
zelda3/room_object_test.cc
|
||||
../src/cli/patch.cc
|
||||
../src/cli/command_handler.cc
|
||||
../src/app/rom.cc
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,21 @@
|
||||
#include "app/emu/memory/memory.h"
|
||||
#include "app/emu/memory/mock_memory.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace emu {
|
||||
namespace yaze_test {
|
||||
namespace emu_test {
|
||||
|
||||
using yaze::app::emu::Clock;
|
||||
using yaze::app::emu::memory::MockClock;
|
||||
using yaze::app::emu::memory::MockMemory;
|
||||
using yaze::app::emu::video::BackgroundMode;
|
||||
using yaze::app::emu::video::PpuInterface;
|
||||
using yaze::app::emu::video::SpriteAttributes;
|
||||
using yaze::app::emu::video::Tilemap;
|
||||
using yaze::app::gfx::Bitmap;
|
||||
|
||||
/**
|
||||
* @brief Mock Ppu class for testing
|
||||
*/
|
||||
class MockPpu : public PpuInterface {
|
||||
public:
|
||||
MOCK_METHOD(void, Write, (uint16_t address, uint8_t data), (override));
|
||||
@@ -28,7 +39,7 @@ class MockPpu : public PpuInterface {
|
||||
|
||||
MOCK_METHOD(const std::vector<uint8_t>&, GetFrameBuffer, (),
|
||||
(const, override));
|
||||
MOCK_METHOD(std::shared_ptr<gfx::Bitmap>, GetScreen, (), (const, override));
|
||||
MOCK_METHOD(std::shared_ptr<Bitmap>, GetScreen, (), (const, override));
|
||||
|
||||
MOCK_METHOD(void, UpdateModeSettings, (), (override));
|
||||
MOCK_METHOD(void, UpdateTileData, (), (override));
|
||||
@@ -48,6 +59,9 @@ class MockPpu : public PpuInterface {
|
||||
BackgroundMode bgMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* \test Test fixture for PPU unit tests
|
||||
*/
|
||||
class PpuTest : public ::testing::Test {
|
||||
protected:
|
||||
MockMemory mock_memory;
|
||||
@@ -141,6 +155,5 @@ TEST_F(PpuTest, FrameComposition) {
|
||||
// buffer
|
||||
}
|
||||
|
||||
} // namespace emu
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
} // namespace emu_test
|
||||
} // namespace yaze_test
|
||||
@@ -4,13 +4,17 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace emu {
|
||||
namespace yaze_test {
|
||||
namespace emu_test {
|
||||
|
||||
using testing::_;
|
||||
using testing::Return;
|
||||
using yaze::app::emu::audio::AudioRam;
|
||||
using yaze::app::emu::audio::Spc700;
|
||||
|
||||
/**
|
||||
* @brief MockAudioRam is a mock class for the AudioRam class.
|
||||
*/
|
||||
class MockAudioRam : public AudioRam {
|
||||
public:
|
||||
MOCK_METHOD(void, reset, (), (override));
|
||||
@@ -51,6 +55,9 @@ class MockAudioRam : public AudioRam {
|
||||
std::vector<uint8_t> internal_audio_ram_ = std::vector<uint8_t>(0x10000, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* \test Spc700Test is a test fixture for the Spc700 class.
|
||||
*/
|
||||
class Spc700Test : public ::testing::Test {
|
||||
public:
|
||||
Spc700Test() = default;
|
||||
@@ -461,6 +468,5 @@ TEST_F(Spc700Test, BootIplRomOk) {
|
||||
// EXPECT_EQ(spc700.PC, 0xFFC1 + 0x3F);
|
||||
}
|
||||
|
||||
} // namespace emu
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
} // namespace emu_test
|
||||
} // namespace yaze_test
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace yaze_test {
|
||||
namespace gfx_test {
|
||||
|
||||
using yaze::app::ROM;
|
||||
using yaze::app::Rom;
|
||||
using yaze::app::gfx::lc_lz2::CompressionContext;
|
||||
using yaze::app::gfx::lc_lz2::CompressionPiece;
|
||||
using yaze::app::gfx::lc_lz2::CompressV2;
|
||||
@@ -32,7 +32,7 @@ using ::testing::TypedEq;
|
||||
|
||||
namespace {
|
||||
|
||||
Bytes ExpectCompressOk(ROM& rom, uchar* in, int in_size) {
|
||||
Bytes ExpectCompressOk(Rom& rom, uchar* in, int in_size) {
|
||||
auto load_status = rom.LoadFromPointer(in, in_size);
|
||||
EXPECT_TRUE(load_status.ok());
|
||||
auto compression_status = CompressV3(rom.vector(), 0, in_size);
|
||||
@@ -41,7 +41,7 @@ Bytes ExpectCompressOk(ROM& rom, uchar* in, int in_size) {
|
||||
return compressed_bytes;
|
||||
}
|
||||
|
||||
Bytes ExpectDecompressBytesOk(ROM& rom, Bytes& in) {
|
||||
Bytes ExpectDecompressBytesOk(Rom& rom, Bytes& in) {
|
||||
auto load_status = rom.LoadFromBytes(in);
|
||||
EXPECT_TRUE(load_status.ok());
|
||||
auto decompression_status = DecompressV2(rom.data(), 0, in.size());
|
||||
@@ -50,7 +50,7 @@ Bytes ExpectDecompressBytesOk(ROM& rom, Bytes& in) {
|
||||
return decompressed_bytes;
|
||||
}
|
||||
|
||||
Bytes ExpectDecompressOk(ROM& rom, uchar* in, int in_size) {
|
||||
Bytes ExpectDecompressOk(Rom& rom, uchar* in, int in_size) {
|
||||
auto load_status = rom.LoadFromPointer(in, in_size);
|
||||
EXPECT_TRUE(load_status.ok());
|
||||
auto decompression_status = DecompressV2(rom.data(), 0, in_size);
|
||||
@@ -130,7 +130,7 @@ TEST(LC_LZ2_CompressionTest, RepeatedBytesBeforeUncompressableRepeated) {
|
||||
}
|
||||
|
||||
TEST(LC_LZ2_CompressionTest, CompressionDecompressionEmptyData) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
uchar empty_input[0] = {};
|
||||
auto comp_result = ExpectCompressOk(rom, empty_input, 0);
|
||||
EXPECT_EQ(0, comp_result.size());
|
||||
@@ -164,7 +164,7 @@ TEST(LC_LZ2_CompressionTest, NewDecompressionPieceOk) {
|
||||
// TODO: Check why header built is off by one
|
||||
// 0x25 instead of 0x24
|
||||
TEST(LC_LZ2_CompressionTest, CompressionSingleSet) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
uchar single_set[5] = {0x2A, 0x2A, 0x2A, 0x2A, 0x2A};
|
||||
uchar single_set_expected[3] = {BUILD_HEADER(1, 5), 0x2A, 0xFF};
|
||||
|
||||
@@ -173,7 +173,7 @@ TEST(LC_LZ2_CompressionTest, CompressionSingleSet) {
|
||||
}
|
||||
|
||||
TEST(LC_LZ2_CompressionTest, CompressionSingleWord) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
uchar single_word[6] = {0x2A, 0x01, 0x2A, 0x01, 0x2A, 0x01};
|
||||
uchar single_word_expected[4] = {BUILD_HEADER(0x02, 0x06), 0x2A, 0x01, 0xFF};
|
||||
|
||||
@@ -182,7 +182,7 @@ TEST(LC_LZ2_CompressionTest, CompressionSingleWord) {
|
||||
}
|
||||
|
||||
TEST(LC_LZ2_CompressionTest, CompressionSingleIncrement) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
uchar single_inc[3] = {0x01, 0x02, 0x03};
|
||||
uchar single_inc_expected[3] = {BUILD_HEADER(0x03, 0x03), 0x01, 0xFF};
|
||||
auto comp_result = ExpectCompressOk(rom, single_inc, 3);
|
||||
@@ -190,7 +190,7 @@ TEST(LC_LZ2_CompressionTest, CompressionSingleIncrement) {
|
||||
}
|
||||
|
||||
TEST(LC_LZ2_CompressionTest, CompressionSingleCopy) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
uchar single_copy[4] = {0x03, 0x0A, 0x07, 0x14};
|
||||
uchar single_copy_expected[6] = {
|
||||
BUILD_HEADER(0x00, 0x04), 0x03, 0x0A, 0x07, 0x14, 0xFF};
|
||||
@@ -404,7 +404,7 @@ TEST(CheckIncByteV3Test, NotAnIncreasingSequence) {
|
||||
}
|
||||
|
||||
TEST(LC_LZ2_CompressionTest, DecompressionValidCommand) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
Bytes simple_copy_input = {BUILD_HEADER(0x00, 0x02), 0x2A, 0x45, 0xFF};
|
||||
uchar simple_copy_output[2] = {0x2A, 0x45};
|
||||
auto decomp_result = ExpectDecompressBytesOk(rom, simple_copy_input);
|
||||
@@ -412,7 +412,7 @@ TEST(LC_LZ2_CompressionTest, DecompressionValidCommand) {
|
||||
}
|
||||
|
||||
TEST(LC_LZ2_CompressionTest, DecompressionMixingCommand) {
|
||||
ROM rom;
|
||||
Rom rom;
|
||||
uchar random1_i[11] = {BUILD_HEADER(0x01, 0x03),
|
||||
0x2A,
|
||||
BUILD_HEADER(0x00, 0x04),
|
||||
@@ -10,16 +10,19 @@
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace test {
|
||||
namespace yaze_test {
|
||||
namespace zelda3_test {
|
||||
|
||||
using yaze::app::Rom;
|
||||
using yaze::app::zelda3::dungeon::DungeonObjectRenderer;
|
||||
|
||||
TEST(DungeonObjectTest, RenderObjectsAsBitmaps) {
|
||||
app::ROM rom;
|
||||
Rom rom;
|
||||
// rom.LoadFromFile("/Users/scawful/Code/yaze/build/bin/zelda3.sfc"));
|
||||
// EXPECT_EQ(rom_status, absl::Status::ok());
|
||||
|
||||
app::zelda3::dungeon::DungeonObjectRenderer renderer;
|
||||
DungeonObjectRenderer renderer;
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace yaze
|
||||
} // namespace zelda3_test
|
||||
} // namespace yaze_test
|
||||
Reference in New Issue
Block a user