diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/MIDDriver.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/MIDDriver.hpp index 5cff599a..89a47314 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/MIDDriver.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/MIDDriver.hpp @@ -56,8 +56,6 @@ namespace HyperSonicDrivers::drivers inline void setTempo(const uint32_t tempo) noexcept { m_midiTempoChanged = true; m_tempo = tempo; } bool open_() noexcept; private: - // this is used to "lock" the device to a specific driver output and passed to IMidiDriver - //std::shared_ptr m_device; // this is to abstract the specific midi driver implementation std::unique_ptr m_midiDriver; std::shared_ptr m_midi; diff --git a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/CMakeLists.txt b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/CMakeLists.txt index 0a286685..bfea9ca4 100644 --- a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/CMakeLists.txt +++ b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/CMakeLists.txt @@ -170,6 +170,13 @@ macro_test( "../fixtures/midifile_sample.mid" ) +macro_test( + EXE TestIMusicDriver + FILES "drivers/TestIMusicDriver.cpp" + LINKS_PRIVATE hyper-sonic-drivers-static + FIXTURES +) + macro_test( EXE TestMameOPL2 FILES "hardware/opl/scummvm/mame/TestMameOPL2.cpp" diff --git a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/drivers/TestIMusicDriver.cpp b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/drivers/TestIMusicDriver.cpp new file mode 100644 index 00000000..4993e965 --- /dev/null +++ b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/drivers/TestIMusicDriver.cpp @@ -0,0 +1,26 @@ +#include +#include +#include + +namespace HyperSonicDrivers::drivers +{ + class IMusicDriverMock : public IMusicDriver + { + public: + IMusicDriverMock(const std::shared_ptr& device) : IMusicDriver(device) {} + void play(const uint8_t track) noexcept override {}; + void stop() noexcept override {}; + bool isPlaying() const noexcept override { return false; }; + }; + + TEST(IMusicDriver, cstor_nullptr) + { + EXPECT_THROW(IMusicDriverMock md(nullptr), std::runtime_error); + } +} + +int main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}