diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cf37b37..e85d7f4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) endif() -project ("sdl2-hyper-sonic-drivers" VERSION 0.12.2 DESCRIPTION "SDL2 based Hyper-Sonic Drivers for emulating old soundcards") +project ("sdl2-hyper-sonic-drivers" VERSION 0.12.3 DESCRIPTION "SDL2 based Hyper-Sonic Drivers for emulating old soundcards") include (TestBigEndian) TEST_BIG_ENDIAN(IS_BIG_ENDIAN) if(IS_BIG_ENDIAN) diff --git a/sdl2-hyper-sonic-drivers/src/std/ILoggerFormatter.hpp b/sdl2-hyper-sonic-drivers/src/std/ILoggerFormatter.hpp new file mode 100644 index 00000000..5bb54b81 --- /dev/null +++ b/sdl2-hyper-sonic-drivers/src/std/ILoggerFormatter.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include + +namespace std +{ + template<> + struct formatter : formatter + { + template + auto format(HyperSonicDrivers::utils::ILogger::eLevel level, FormatContext& fc) const + { + string str; + + switch (level) + { + using enum HyperSonicDrivers::utils::ILogger::eLevel; + + case Trace: + str = "Trace"; + break; + case Debug: + str = "Debug"; + break; + case Info: + str = "Info"; + break; + case Warning: + str = "Warning"; + break; + case Error: + str = "Error"; + break; + case Critical: + str = "Critical"; + break; + case Off: + str = "Off"; + break; + } + + return formatter::format(str, fc); + } + }; +} diff --git a/sdl2-hyper-sonic-drivers/test/std/CMakeLists.txt b/sdl2-hyper-sonic-drivers/test/std/CMakeLists.txt index 799ae0bc..e29adebc 100644 --- a/sdl2-hyper-sonic-drivers/test/std/CMakeLists.txt +++ b/sdl2-hyper-sonic-drivers/test/std/CMakeLists.txt @@ -61,3 +61,8 @@ macro_test( FILES "eChannelGroupFormatterTest.cpp" ) +macro_test( + EXE TestIloggerFormatter + FILES "ILoggerFormatterTest.cpp" +) + diff --git a/sdl2-hyper-sonic-drivers/test/std/ILoggerFormatterTest.cpp b/sdl2-hyper-sonic-drivers/test/std/ILoggerFormatterTest.cpp new file mode 100644 index 00000000..82d53cbd --- /dev/null +++ b/sdl2-hyper-sonic-drivers/test/std/ILoggerFormatterTest.cpp @@ -0,0 +1,17 @@ +#include +#include +#include + +namespace std +{ + TEST(ILoggerFormatter, Music) + { + ASSERT_STRCASEEQ(std::format("{}", HyperSonicDrivers::utils::ILogger::eLevel::Critical).c_str(), "Critical"); + } +} + +int main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}