summaryrefslogtreecommitdiffhomepage
path: root/StarsEx
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-03-07 23:59:51 +0100
committerAki <please@ignore.pl>2024-03-07 23:59:51 +0100
commit3f857bb284d3c8aa99bcd61980e0f0cab2dd8e19 (patch)
tree4a2724f89ce213b1834d5550229243cccfad9fb3 /StarsEx
parent1ef05b8b227194ec32ae49f0eaf3e483ef35bb6b (diff)
downloadstarshatter-3f857bb284d3c8aa99bcd61980e0f0cab2dd8e19.zip
starshatter-3f857bb284d3c8aa99bcd61980e0f0cab2dd8e19.tar.gz
starshatter-3f857bb284d3c8aa99bcd61980e0f0cab2dd8e19.tar.bz2
Added gtest to the project and a stub test for showcase
Diffstat (limited to 'StarsEx')
-rw-r--r--StarsEx/CMakeLists.txt7
-rw-r--r--StarsEx/test/AudioConfig.cpp16
2 files changed, 23 insertions, 0 deletions
diff --git a/StarsEx/CMakeLists.txt b/StarsEx/CMakeLists.txt
index 1dc025d..1bacde7 100644
--- a/StarsEx/CMakeLists.txt
+++ b/StarsEx/CMakeLists.txt
@@ -329,3 +329,10 @@ else()
PUBLIC -l:libdxguid.a
)
endif()
+add_executable(
+ ${PROJECT_NAME}_test
+ test/AudioConfig.cpp
+ )
+generate_emulator(${PROJECT_NAME}_test LIBS Opcode ArchiveEx)
+target_link_libraries(${PROJECT_NAME}_test PRIVATE ${PROJECT_NAME} GTest::gtest_main)
+gtest_discover_tests(${PROJECT_NAME}_test DISCOVERY_TIMEOUT 60)
diff --git a/StarsEx/test/AudioConfig.cpp b/StarsEx/test/AudioConfig.cpp
new file mode 100644
index 0000000..f6a05d4
--- /dev/null
+++ b/StarsEx/test/AudioConfig.cpp
@@ -0,0 +1,16 @@
+#include <gtest/gtest.h>
+
+#include <AudioConfig.h>
+
+
+TEST(StarsEx, AudioConfig)
+{
+ AudioConfig audio; // as a side-effect constructor sets the static instance
+ ASSERT_EQ(&audio, AudioConfig::GetInstance());
+ audio.SetMenuMusic(100);
+ ASSERT_EQ(0, AudioConfig::MenuMusic());
+ audio.SetMenuMusic(50);
+ ASSERT_EQ(-2500, AudioConfig::MenuMusic());
+ audio.SetMenuMusic(0);
+ ASSERT_EQ(-5000, AudioConfig::MenuMusic());
+}