diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 66023f68..76c7c061 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,18 +14,21 @@ add_executable( yaze_test yaze_test.cc rom_test.cc + asm_test.cc ../src/app/rom.cc ../src/app/asm/script.cc ../src/app/gfx/bitmap.cc ../src/app/gfx/snes_tile.cc ../src/app/gfx/snes_palette.cc ../src/app/core/common.cc + ../src/lib/asar/src/asar-dll-bindings/c/asardll.c ) target_include_directories( yaze_test PUBLIC - ../src/lib/ ../src/ + ../src/lib/ + ../src/lib/asar/src/asar-dll-bindings/c ${SDL_INCLUDE_DIRS} ) diff --git a/test/asm_test.cc b/test/asm_test.cc new file mode 100644 index 00000000..cff67106 --- /dev/null +++ b/test/asm_test.cc @@ -0,0 +1,48 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "app/asm/script.h" +#include "app/core/constants.h" +#include "app/rom.h" + +namespace yaze_test { +namespace asm_test { + +using yaze::app::ROM; +using yaze::app::snes_asm::Script; + +using ::testing::_; +using ::testing::ElementsAreArray; +using ::testing::Return; +using ::testing::TypedEq; + +class MockScript : public Script { + public: + MOCK_METHOD(absl::Status, ApplyPatchToROM, (ROM & rom)); +}; + +TEST(ASMTest, NoPatchLoadedError) { + ROM rom; + MockScript script; + EXPECT_CALL(script, ApplyPatchToROM(_)) + .WillOnce(Return(absl::InvalidArgumentError("No patch loaded!"))); + + EXPECT_THAT(script.ApplyPatchToROM(rom), + absl::InvalidArgumentError("No patch loaded!")); +} + +TEST(ASMTest, ApplyPatchOk) {} + +} // namespace asm_test +} // namespace yaze_test \ No newline at end of file