diff options
author | hsdk123 <[email protected]> | 2023-06-11 23:31:03 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2023-06-12 03:31:03 +0000 |
commit | 2d86d8b84fa54df4f6ce5e4942e617164cb5cc6d (patch) | |
tree | 9e53fc6ed81cd4b4043423eeeacf10f4aad860bf /tests | |
parent | 3d9900476ec49b2994b7163a451a69560d498306 (diff) |
Add gtest integration (#860)
* Add gtest integration
* Update gtest fetch
* Add ctest
* Update CI
* Update CI
* enable testing
* Make tests off by default
* Update gitignore
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 24 | ||||
-rw-r--r-- | tests/example.t.cpp | 16 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..492587e8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,24 @@ +add_executable(OpenAL_Tests)
+
+include(FetchContent)
+FetchContent_Declare(
+ googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG main
+)
+# For Windows: Prevent overriding the parent project's compiler/linker settings
+set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+FetchContent_MakeAvailable(googletest)
+
+target_link_libraries(OpenAL_Tests PRIVATE
+ OpenAL
+ GTest::gtest_main
+)
+
+target_sources(OpenAL_Tests PRIVATE
+example.t.cpp
+)
+
+# This needs to come last
+include(GoogleTest)
+gtest_discover_tests(OpenAL_Tests)
diff --git a/tests/example.t.cpp b/tests/example.t.cpp new file mode 100644 index 00000000..30341e8b --- /dev/null +++ b/tests/example.t.cpp @@ -0,0 +1,16 @@ +#include <gtest/gtest.h>
+#include <AL/al.h>
+
+class ExampleTest : public ::testing::Test {
+};
+
+
+TEST_F(ExampleTest, Basic)
+{
+ // just making sure we compile
+ ALuint source, buffer;
+ ALfloat offset;
+ ALenum state;
+}
+
+
|