Refactor test files: remove unused namespaces and improve include organization for clarity
This commit is contained in:
@@ -3,21 +3,18 @@
|
|||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "app/emu/cpu/clock.h"
|
|
||||||
#include "app/emu/cpu/internal/opcodes.h"
|
|
||||||
#include "app/emu/memory/asm_parser.h"
|
#include "app/emu/memory/asm_parser.h"
|
||||||
#include "app/emu/memory/memory.h"
|
#include "app/emu/memory/memory.h"
|
||||||
#include "test/mocks/mock_memory.h"
|
#include "test/mocks/mock_memory.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace emu {
|
|
||||||
|
|
||||||
using yaze::emu::AsmParser;
|
using yaze::emu::AsmParser;
|
||||||
using yaze::emu::Cpu;
|
using yaze::emu::Cpu;
|
||||||
using yaze::emu::memory::CpuCallbacks;
|
using yaze::emu::CpuCallbacks;
|
||||||
using yaze::emu::memory::MockClock;
|
using yaze::emu::MockClock;
|
||||||
using yaze::emu::memory::MockMemory;
|
using yaze::emu::MockMemory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \test Test fixture for CPU unit tests
|
* \test Test fixture for CPU unit tests
|
||||||
@@ -4198,6 +4195,5 @@ TEST_F(CpuTest, XCESwitchBackAndForth) {
|
|||||||
EXPECT_FALSE(cpu.E); // Emulation mode flag should be cleared
|
EXPECT_FALSE(cpu.E); // Emulation mode flag should be cleared
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace emu
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -2,22 +2,17 @@
|
|||||||
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
|
|
||||||
#include "app/emu/cpu/clock.h"
|
|
||||||
#include "app/emu/memory/memory.h"
|
|
||||||
#include "test/mocks/mock_memory.h"
|
#include "test/mocks/mock_memory.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace emu {
|
|
||||||
|
|
||||||
using yaze::emu::Clock;
|
using yaze::emu::MockClock;
|
||||||
using yaze::emu::memory::MockClock;
|
using yaze::emu::MockMemory;
|
||||||
using yaze::emu::memory::MockMemory;
|
using yaze::emu::BackgroundMode;
|
||||||
using yaze::emu::video::BackgroundMode;
|
using yaze::emu::PpuInterface;
|
||||||
using yaze::emu::video::PpuInterface;
|
using yaze::emu::SpriteAttributes;
|
||||||
using yaze::emu::video::SpriteAttributes;
|
using yaze::emu::Tilemap;
|
||||||
using yaze::emu::video::Tilemap;
|
|
||||||
using yaze::gfx::Bitmap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Mock Ppu class for testing
|
* @brief Mock Ppu class for testing
|
||||||
@@ -57,6 +52,5 @@ class PpuTest : public ::testing::Test {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emu
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -6,13 +6,12 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace emu {
|
|
||||||
|
|
||||||
using testing::_;
|
using testing::_;
|
||||||
using testing::Return;
|
using testing::Return;
|
||||||
using yaze::emu::audio::ApuCallbacks;
|
using yaze::emu::ApuCallbacks;
|
||||||
using yaze::emu::audio::AudioRam;
|
using yaze::emu::AudioRam;
|
||||||
using yaze::emu::audio::Spc700;
|
using yaze::emu::Spc700;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MockAudioRam is a mock class for the AudioRam class.
|
* @brief MockAudioRam is a mock class for the AudioRam class.
|
||||||
@@ -471,6 +470,5 @@ TEST_F(Spc700Test, BootIplRomOk) {
|
|||||||
// EXPECT_EQ(spc700.PC, 0xFFC1 + 0x3F);
|
// EXPECT_EQ(spc700.PC, 0xFFC1 + 0x3F);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace emu
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace gfx {
|
|
||||||
|
|
||||||
using yaze::Rom;
|
using yaze::Rom;
|
||||||
using yaze::gfx::lc_lz2::CompressionContext;
|
using yaze::gfx::lc_lz2::CompressionContext;
|
||||||
@@ -423,6 +422,5 @@ TEST(LC_LZ2_CompressionTest, DecompressionMixingCommand) {
|
|||||||
EXPECT_THAT(random1_o, ElementsAreArray(decomp_result.data(), 9));
|
EXPECT_THAT(random1_o, ElementsAreArray(decomp_result.data(), 9));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace gfx
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -7,11 +7,10 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace gfx {
|
|
||||||
|
|
||||||
using ::testing::ElementsAreArray;
|
using ::testing::ElementsAreArray;
|
||||||
using yaze::gfx::ConvertRgbToSnes;
|
using yaze::gfx::ConvertRgbToSnes;
|
||||||
using yaze::gfx::ConvertSnestoRGB;
|
using yaze::gfx::ConvertSnestoRgb;
|
||||||
using yaze::gfx::Extract;
|
using yaze::gfx::Extract;
|
||||||
using yaze::gfx::SnesPalette;
|
using yaze::gfx::SnesPalette;
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ TEST(SnesColorTest, ConvertRgbToSnes) {
|
|||||||
|
|
||||||
TEST(SnesColorTest, ConvertSnestoRGB) {
|
TEST(SnesColorTest, ConvertSnestoRGB) {
|
||||||
uint16_t snes = 0x4210;
|
uint16_t snes = 0x4210;
|
||||||
snes_color color = ConvertSnestoRGB(snes);
|
snes_color color = ConvertSnestoRgb(snes);
|
||||||
ASSERT_EQ(color.red, 132);
|
ASSERT_EQ(color.red, 132);
|
||||||
ASSERT_EQ(color.green, 132);
|
ASSERT_EQ(color.green, 132);
|
||||||
ASSERT_EQ(color.blue, 132);
|
ASSERT_EQ(color.blue, 132);
|
||||||
@@ -53,13 +52,13 @@ TEST(SnesColorTest, ConvertSnesToRGB_Binary) {
|
|||||||
uint16_t purple = 0b0111110000011111;
|
uint16_t purple = 0b0111110000011111;
|
||||||
snes_color testcolor;
|
snes_color testcolor;
|
||||||
|
|
||||||
testcolor = ConvertSnestoRGB(red);
|
testcolor = ConvertSnestoRgb(red);
|
||||||
ASSERT_EQ(0xFF0000, test_convert(testcolor));
|
ASSERT_EQ(0xFF0000, test_convert(testcolor));
|
||||||
testcolor = ConvertSnestoRGB(green);
|
testcolor = ConvertSnestoRgb(green);
|
||||||
ASSERT_EQ(0x00FF00, test_convert(testcolor));
|
ASSERT_EQ(0x00FF00, test_convert(testcolor));
|
||||||
testcolor = ConvertSnestoRGB(blue);
|
testcolor = ConvertSnestoRgb(blue);
|
||||||
ASSERT_EQ(0x0000FF, test_convert(testcolor));
|
ASSERT_EQ(0x0000FF, test_convert(testcolor));
|
||||||
testcolor = ConvertSnestoRGB(purple);
|
testcolor = ConvertSnestoRgb(purple);
|
||||||
ASSERT_EQ(0xFF00FF, test_convert(testcolor));
|
ASSERT_EQ(0xFF00FF, test_convert(testcolor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +92,5 @@ TEST(SnesColorTest, Convert) {
|
|||||||
EXPECT_THAT(data, ElementsAreArray(snes_string.data(), 10));
|
EXPECT_THAT(data, ElementsAreArray(snes_string.data(), 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace gfx
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace emu {
|
namespace emu {
|
||||||
namespace memory {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Mock CPU class for testing
|
* @brief Mock CPU class for testing
|
||||||
@@ -220,7 +219,6 @@ class MockMemory : public Memory {
|
|||||||
uint16_t SP_ = 0x01FF;
|
uint16_t SP_ = 0x01FF;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace memory
|
|
||||||
} // namespace emu
|
} // namespace emu
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,12 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/gfx/snes_color.h"
|
|
||||||
#include "test/core/testing.h"
|
#include "test/core/testing.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
using ::testing::DoAll;
|
|
||||||
using ::testing::Return;
|
using ::testing::Return;
|
||||||
|
|
||||||
const static std::vector<uint8_t> kMockRomData = {
|
const static std::vector<uint8_t> kMockRomData = {
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
|
|
||||||
#include "yaze.h"
|
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "absl/debugging/failure_signal_handler.h"
|
#include "absl/debugging/failure_signal_handler.h"
|
||||||
#include "absl/debugging/symbolize.h"
|
#include "absl/debugging/symbolize.h"
|
||||||
#include "test/integration/test_editor.h"
|
#include "test/integration/test_editor.h"
|
||||||
|
|
||||||
namespace yaze {
|
|
||||||
namespace test {} // namespace test
|
|
||||||
} // namespace yaze
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
absl::InitializeSymbolizer(argv[0]);
|
absl::InitializeSymbolizer(argv[0]);
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
|
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
#include "app/zelda3/dungeon/room.h"
|
#include "app/zelda3/dungeon/room.h"
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace zelda3 {
|
|
||||||
|
|
||||||
class DungeonRoomTest : public ::testing::Test, public SharedRom {
|
class DungeonRoomTest : public ::testing::Test, public SharedRom {
|
||||||
protected:
|
protected:
|
||||||
@@ -31,6 +29,5 @@ TEST_F(DungeonRoomTest, SingleRoomLoadOk) {
|
|||||||
test_room.LoadRoomFromROM();
|
test_room.LoadRoomFromROM();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace zelda3
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace zelda3 {
|
|
||||||
|
|
||||||
class MessageTest : public ::testing::Test, public SharedRom {
|
class MessageTest : public ::testing::Test, public SharedRom {
|
||||||
protected:
|
protected:
|
||||||
@@ -44,6 +43,5 @@ TEST_F(MessageTest, VerifySingleMessageFromRomOk) {
|
|||||||
// TODO - Implement this test
|
// TODO - Implement this test
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace zelda3
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace zelda3 {
|
|
||||||
|
|
||||||
class OverworldTest : public ::testing::Test, public SharedRom {
|
class OverworldTest : public ::testing::Test, public SharedRom {
|
||||||
protected:
|
protected:
|
||||||
@@ -53,6 +52,5 @@ TEST_F(OverworldTest, OverworldLoadRomDataOk) {
|
|||||||
zelda3::kNumTile16Individual);
|
zelda3::kNumTile16Individual);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace zelda3
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace zelda3 {
|
|
||||||
|
|
||||||
using namespace yaze::zelda3;
|
using namespace yaze::zelda3;
|
||||||
|
|
||||||
@@ -61,6 +60,5 @@ TEST_F(SpriteBuilderTest, BuildSpritePropertiesOk) {
|
|||||||
)"));
|
)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace zelda3
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
Reference in New Issue
Block a user