From 4b6266e3f2c59cbe56c6cdec78d732b8edd66127 Mon Sep 17 00:00:00 2001 From: Wunkolo <Wunkolo@gmail.com> Date: Mon, 11 Mar 2024 12:47:59 -0700 Subject: [PATCH] Initialize catch-2 based unit tests --- CMakeLists.txt | 17 +++++++++++++++++ tests/dynapica.cpp | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/dynapica.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d8a69acb..25ce0644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ option(GPU_DEBUG_INFO "Enable additional GPU debugging info" OFF) option(ENABLE_OPENGL "Enable OpenGL rendering backend" ON) option(ENABLE_VULKAN "Enable Vulkan rendering backend" ON) option(ENABLE_LTO "Enable link-time optimization" OFF) +option(ENABLE_TESTS "Compile unit-tests" OFF) option(ENABLE_USER_BUILD "Make a user-facing build. These builds have various assertions disabled, LTO, and more" OFF) option(ENABLE_HTTP_SERVER "Enable HTTP server. Used for Discord bot support" OFF) option(ENABLE_DISCORD_RPC "Compile with Discord RPC support (disabled by default)" ON) @@ -520,3 +521,19 @@ endif() if(ENABLE_LTO OR ENABLE_USER_BUILD) set_target_properties(Alber PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) endif() + +if(ENABLE_TESTS) + enable_testing() + find_package(Catch2 3 REQUIRED) + add_executable(AlberTests + tests/dynapica.cpp + ) + target_link_libraries( + AlberTests + PRIVATE + Catch2::Catch2WithMain + AlberCore + ) + + add_test(AlberTests AlberTests) +endif() \ No newline at end of file diff --git a/tests/dynapica.cpp b/tests/dynapica.cpp new file mode 100644 index 00000000..ce0b06bf --- /dev/null +++ b/tests/dynapica.cpp @@ -0,0 +1,10 @@ +#include <PICA/dynapica/shader_rec.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> + +#include "PICA/shader.hpp" + +#if defined(PANDA3DS_SHADER_JIT_SUPPORTED) +TEST_CASE("Test", "[shader][dynapica]") {} + +#endif \ No newline at end of file