diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3e318ba97..eb24e0594 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -106,14 +106,14 @@ jobs: - name: Run unit tests and generate coverage output (Linux) if: runner.os == 'Linux' run: | - xmake run NazaraUnitTests + xmake run UnitTests gcovr -x coverage.out -s -f 'include/Nazara/.*' -f 'src/Nazara/.*' build/.objs/ - name: Run unit tests and generate coverage output (Windows) if: runner.os == 'Windows' shell: cmd run: | - "C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe" --export_type cobertura:coverage.out --sources "NazaraEngine\include\Nazara\*" --sources "NazaraEngine\src\Nazara\*" --modules "NazaraEngine\bin\*" --cover_children -- xmake run NazaraUnitTests + "C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe" --export_type cobertura:coverage.out --sources "NazaraEngine\include\Nazara\*" --sources "NazaraEngine\src\Nazara\*" --modules "NazaraEngine\bin\*" --cover_children -- xmake run UnitTests - name: Upload Coverage Report to Codecov uses: codecov/codecov-action@v3 diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index cb7af763f..6df5de1be 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -79,7 +79,7 @@ jobs: # Run unit tests - name: Run unit tests if: matrix.mode != 'releasedbg' - run: xmake run NazaraUnitTests + run: xmake run UnitTests # Setup installation configuration - name: Configure xmake for installation diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 445b0e497..b1bc93dec 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -72,7 +72,7 @@ jobs: # Run unit tests - name: Run unit tests if: matrix.mode != 'releasedbg' - run: xmake run NazaraUnitTests + run: xmake run UnitTests # Setup installation configuration - name: Configure xmake for installation diff --git a/.github/workflows/msys2-build.yml b/.github/workflows/msys2-build.yml index 59fe17a16..e9581b76c 100644 --- a/.github/workflows/msys2-build.yml +++ b/.github/workflows/msys2-build.yml @@ -102,7 +102,7 @@ jobs: # Run unit tests - name: Run unit tests if: matrix.mode != 'releasedbg' - run: xmake run NazaraUnitTests + run: xmake run UnitTests # Setup installation configuration - name: Configure xmake for installation diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index a7ff344d5..bb9874a90 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -73,7 +73,7 @@ jobs: # Run unit tests - name: Run unit tests if: matrix.mode != 'releasedbg' - run: xmake run NazaraUnitTests + run: xmake run UnitTests # Setup installation configuration - name: Configure xmake for installation diff --git a/examples/xmake.lua b/examples/xmake.lua index 2e114e9dd..5d4fbaf97 100644 --- a/examples/xmake.lua +++ b/examples/xmake.lua @@ -1,9 +1,7 @@ option("examples", { description = "Build examples", default = true }) if has_config("examples") then - -- Common config set_group("Examples") - set_kind("binary") includes("*/xmake.lua") end diff --git a/examples/ComputeTest/main.cpp b/tests/ComputeTest/main.cpp similarity index 100% rename from examples/ComputeTest/main.cpp rename to tests/ComputeTest/main.cpp diff --git a/examples/ComputeTest/xmake.lua b/tests/ComputeTest/xmake.lua similarity index 100% rename from examples/ComputeTest/xmake.lua rename to tests/ComputeTest/xmake.lua diff --git a/examples/GraphicsTest/main.cpp b/tests/GraphicsTest/main.cpp similarity index 100% rename from examples/GraphicsTest/main.cpp rename to tests/GraphicsTest/main.cpp diff --git a/examples/GraphicsTest/xmake.lua b/tests/GraphicsTest/xmake.lua similarity index 100% rename from examples/GraphicsTest/xmake.lua rename to tests/GraphicsTest/xmake.lua diff --git a/examples/RenderTest/main.cpp b/tests/RenderTest/main.cpp similarity index 100% rename from examples/RenderTest/main.cpp rename to tests/RenderTest/main.cpp diff --git a/examples/RenderTest/xmake.lua b/tests/RenderTest/xmake.lua similarity index 100% rename from examples/RenderTest/xmake.lua rename to tests/RenderTest/xmake.lua diff --git a/examples/Std140Debug/main.cpp b/tests/Std140Debug/main.cpp similarity index 100% rename from examples/Std140Debug/main.cpp rename to tests/Std140Debug/main.cpp diff --git a/examples/Std140Debug/xmake.lua b/tests/Std140Debug/xmake.lua similarity index 100% rename from examples/Std140Debug/xmake.lua rename to tests/Std140Debug/xmake.lua diff --git a/tests/Engine/Audio/AlgorithmAudioTest.cpp b/tests/UnitTests/Engine/Audio/AlgorithmAudioTest.cpp similarity index 100% rename from tests/Engine/Audio/AlgorithmAudioTest.cpp rename to tests/UnitTests/Engine/Audio/AlgorithmAudioTest.cpp diff --git a/tests/Engine/Audio/MusicTest.cpp b/tests/UnitTests/Engine/Audio/MusicTest.cpp similarity index 100% rename from tests/Engine/Audio/MusicTest.cpp rename to tests/UnitTests/Engine/Audio/MusicTest.cpp diff --git a/tests/Engine/Audio/SoundBufferTest.cpp b/tests/UnitTests/Engine/Audio/SoundBufferTest.cpp similarity index 100% rename from tests/Engine/Audio/SoundBufferTest.cpp rename to tests/UnitTests/Engine/Audio/SoundBufferTest.cpp diff --git a/tests/Engine/Audio/SoundEmitterTest.cpp b/tests/UnitTests/Engine/Audio/SoundEmitterTest.cpp similarity index 100% rename from tests/Engine/Audio/SoundEmitterTest.cpp rename to tests/UnitTests/Engine/Audio/SoundEmitterTest.cpp diff --git a/tests/Engine/Audio/SoundStreamTest.cpp b/tests/UnitTests/Engine/Audio/SoundStreamTest.cpp similarity index 100% rename from tests/Engine/Audio/SoundStreamTest.cpp rename to tests/UnitTests/Engine/Audio/SoundStreamTest.cpp diff --git a/tests/Engine/Audio/SoundTest.cpp b/tests/UnitTests/Engine/Audio/SoundTest.cpp similarity index 100% rename from tests/Engine/Audio/SoundTest.cpp rename to tests/UnitTests/Engine/Audio/SoundTest.cpp diff --git a/tests/Engine/ClientModules.hpp b/tests/UnitTests/Engine/ClientModules.hpp similarity index 100% rename from tests/Engine/ClientModules.hpp rename to tests/UnitTests/Engine/ClientModules.hpp diff --git a/tests/Engine/Core/AbstractHashTest.cpp b/tests/UnitTests/Engine/Core/AbstractHashTest.cpp similarity index 100% rename from tests/Engine/Core/AbstractHashTest.cpp rename to tests/UnitTests/Engine/Core/AbstractHashTest.cpp diff --git a/tests/Engine/Core/AlgorithmCoreTest.cpp b/tests/UnitTests/Engine/Core/AlgorithmCoreTest.cpp similarity index 100% rename from tests/Engine/Core/AlgorithmCoreTest.cpp rename to tests/UnitTests/Engine/Core/AlgorithmCoreTest.cpp diff --git a/tests/Engine/Core/BufferingTest.cpp b/tests/UnitTests/Engine/Core/BufferingTest.cpp similarity index 100% rename from tests/Engine/Core/BufferingTest.cpp rename to tests/UnitTests/Engine/Core/BufferingTest.cpp diff --git a/tests/Engine/Core/ByteArrayTest.cpp b/tests/UnitTests/Engine/Core/ByteArrayTest.cpp similarity index 100% rename from tests/Engine/Core/ByteArrayTest.cpp rename to tests/UnitTests/Engine/Core/ByteArrayTest.cpp diff --git a/tests/Engine/Core/ByteStreamTest.cpp b/tests/UnitTests/Engine/Core/ByteStreamTest.cpp similarity index 100% rename from tests/Engine/Core/ByteStreamTest.cpp rename to tests/UnitTests/Engine/Core/ByteStreamTest.cpp diff --git a/tests/Engine/Core/ClockTest.cpp b/tests/UnitTests/Engine/Core/ClockTest.cpp similarity index 100% rename from tests/Engine/Core/ClockTest.cpp rename to tests/UnitTests/Engine/Core/ClockTest.cpp diff --git a/tests/Engine/Core/ColorTest.cpp b/tests/UnitTests/Engine/Core/ColorTest.cpp similarity index 100% rename from tests/Engine/Core/ColorTest.cpp rename to tests/UnitTests/Engine/Core/ColorTest.cpp diff --git a/tests/Engine/Core/ErrorTest.cpp b/tests/UnitTests/Engine/Core/ErrorTest.cpp similarity index 100% rename from tests/Engine/Core/ErrorTest.cpp rename to tests/UnitTests/Engine/Core/ErrorTest.cpp diff --git a/tests/Engine/Core/FileTest.cpp b/tests/UnitTests/Engine/Core/FileTest.cpp similarity index 100% rename from tests/Engine/Core/FileTest.cpp rename to tests/UnitTests/Engine/Core/FileTest.cpp diff --git a/tests/Engine/Core/ObjectHandleTest.cpp b/tests/UnitTests/Engine/Core/ObjectHandleTest.cpp similarity index 100% rename from tests/Engine/Core/ObjectHandleTest.cpp rename to tests/UnitTests/Engine/Core/ObjectHandleTest.cpp diff --git a/tests/Engine/Core/ObjectRefTest.cpp b/tests/UnitTests/Engine/Core/ObjectRefTest.cpp similarity index 100% rename from tests/Engine/Core/ObjectRefTest.cpp rename to tests/UnitTests/Engine/Core/ObjectRefTest.cpp diff --git a/tests/Engine/Core/ParameterListTest.cpp b/tests/UnitTests/Engine/Core/ParameterListTest.cpp similarity index 100% rename from tests/Engine/Core/ParameterListTest.cpp rename to tests/UnitTests/Engine/Core/ParameterListTest.cpp diff --git a/tests/Engine/Core/PrimitiveListTest.cpp b/tests/UnitTests/Engine/Core/PrimitiveListTest.cpp similarity index 100% rename from tests/Engine/Core/PrimitiveListTest.cpp rename to tests/UnitTests/Engine/Core/PrimitiveListTest.cpp diff --git a/tests/Engine/Core/RefCountedTest.cpp b/tests/UnitTests/Engine/Core/RefCountedTest.cpp similarity index 100% rename from tests/Engine/Core/RefCountedTest.cpp rename to tests/UnitTests/Engine/Core/RefCountedTest.cpp diff --git a/tests/Engine/Core/SerializationTest.cpp b/tests/UnitTests/Engine/Core/SerializationTest.cpp similarity index 100% rename from tests/Engine/Core/SerializationTest.cpp rename to tests/UnitTests/Engine/Core/SerializationTest.cpp diff --git a/tests/Engine/Core/StringExtTest.cpp b/tests/UnitTests/Engine/Core/StringExtTest.cpp similarity index 100% rename from tests/Engine/Core/StringExtTest.cpp rename to tests/UnitTests/Engine/Core/StringExtTest.cpp diff --git a/tests/Engine/Core/UuidTest.cpp b/tests/UnitTests/Engine/Core/UuidTest.cpp similarity index 100% rename from tests/Engine/Core/UuidTest.cpp rename to tests/UnitTests/Engine/Core/UuidTest.cpp diff --git a/tests/Engine/Core/VirtualDirectoryTest.cpp b/tests/UnitTests/Engine/Core/VirtualDirectoryTest.cpp similarity index 100% rename from tests/Engine/Core/VirtualDirectoryTest.cpp rename to tests/UnitTests/Engine/Core/VirtualDirectoryTest.cpp diff --git a/tests/Engine/Math/AlgorithmMathTest.cpp b/tests/UnitTests/Engine/Math/AlgorithmMathTest.cpp similarity index 100% rename from tests/Engine/Math/AlgorithmMathTest.cpp rename to tests/UnitTests/Engine/Math/AlgorithmMathTest.cpp diff --git a/tests/Engine/Math/AngleTest.cpp b/tests/UnitTests/Engine/Math/AngleTest.cpp similarity index 100% rename from tests/Engine/Math/AngleTest.cpp rename to tests/UnitTests/Engine/Math/AngleTest.cpp diff --git a/tests/Engine/Math/BoundingVolumeTest.cpp b/tests/UnitTests/Engine/Math/BoundingVolumeTest.cpp similarity index 100% rename from tests/Engine/Math/BoundingVolumeTest.cpp rename to tests/UnitTests/Engine/Math/BoundingVolumeTest.cpp diff --git a/tests/Engine/Math/BoxTest.cpp b/tests/UnitTests/Engine/Math/BoxTest.cpp similarity index 100% rename from tests/Engine/Math/BoxTest.cpp rename to tests/UnitTests/Engine/Math/BoxTest.cpp diff --git a/tests/Engine/Math/EulerAnglesTest.cpp b/tests/UnitTests/Engine/Math/EulerAnglesTest.cpp similarity index 100% rename from tests/Engine/Math/EulerAnglesTest.cpp rename to tests/UnitTests/Engine/Math/EulerAnglesTest.cpp diff --git a/tests/Engine/Math/FrustumTest.cpp b/tests/UnitTests/Engine/Math/FrustumTest.cpp similarity index 100% rename from tests/Engine/Math/FrustumTest.cpp rename to tests/UnitTests/Engine/Math/FrustumTest.cpp diff --git a/tests/Engine/Math/Matrix4Test.cpp b/tests/UnitTests/Engine/Math/Matrix4Test.cpp similarity index 100% rename from tests/Engine/Math/Matrix4Test.cpp rename to tests/UnitTests/Engine/Math/Matrix4Test.cpp diff --git a/tests/Engine/Math/OrientedBoxTest.cpp b/tests/UnitTests/Engine/Math/OrientedBoxTest.cpp similarity index 100% rename from tests/Engine/Math/OrientedBoxTest.cpp rename to tests/UnitTests/Engine/Math/OrientedBoxTest.cpp diff --git a/tests/Engine/Math/PlaneTest.cpp b/tests/UnitTests/Engine/Math/PlaneTest.cpp similarity index 100% rename from tests/Engine/Math/PlaneTest.cpp rename to tests/UnitTests/Engine/Math/PlaneTest.cpp diff --git a/tests/Engine/Math/QuaternionTest.cpp b/tests/UnitTests/Engine/Math/QuaternionTest.cpp similarity index 100% rename from tests/Engine/Math/QuaternionTest.cpp rename to tests/UnitTests/Engine/Math/QuaternionTest.cpp diff --git a/tests/Engine/Math/RayTest.cpp b/tests/UnitTests/Engine/Math/RayTest.cpp similarity index 100% rename from tests/Engine/Math/RayTest.cpp rename to tests/UnitTests/Engine/Math/RayTest.cpp diff --git a/tests/Engine/Math/RectTest.cpp b/tests/UnitTests/Engine/Math/RectTest.cpp similarity index 100% rename from tests/Engine/Math/RectTest.cpp rename to tests/UnitTests/Engine/Math/RectTest.cpp diff --git a/tests/Engine/Math/SphereTest.cpp b/tests/UnitTests/Engine/Math/SphereTest.cpp similarity index 100% rename from tests/Engine/Math/SphereTest.cpp rename to tests/UnitTests/Engine/Math/SphereTest.cpp diff --git a/tests/Engine/Math/Vector2Test.cpp b/tests/UnitTests/Engine/Math/Vector2Test.cpp similarity index 100% rename from tests/Engine/Math/Vector2Test.cpp rename to tests/UnitTests/Engine/Math/Vector2Test.cpp diff --git a/tests/Engine/Math/Vector3Test.cpp b/tests/UnitTests/Engine/Math/Vector3Test.cpp similarity index 100% rename from tests/Engine/Math/Vector3Test.cpp rename to tests/UnitTests/Engine/Math/Vector3Test.cpp diff --git a/tests/Engine/Math/Vector4Test.cpp b/tests/UnitTests/Engine/Math/Vector4Test.cpp similarity index 100% rename from tests/Engine/Math/Vector4Test.cpp rename to tests/UnitTests/Engine/Math/Vector4Test.cpp diff --git a/tests/Engine/Modules.hpp b/tests/UnitTests/Engine/Modules.hpp similarity index 100% rename from tests/Engine/Modules.hpp rename to tests/UnitTests/Engine/Modules.hpp diff --git a/tests/Engine/Network/IpAddressTest.cpp b/tests/UnitTests/Engine/Network/IpAddressTest.cpp similarity index 100% rename from tests/Engine/Network/IpAddressTest.cpp rename to tests/UnitTests/Engine/Network/IpAddressTest.cpp diff --git a/tests/Engine/Network/SocketPollerTest.cpp b/tests/UnitTests/Engine/Network/SocketPollerTest.cpp similarity index 100% rename from tests/Engine/Network/SocketPollerTest.cpp rename to tests/UnitTests/Engine/Network/SocketPollerTest.cpp diff --git a/tests/Engine/Network/TCPTest.cpp b/tests/UnitTests/Engine/Network/TCPTest.cpp similarity index 100% rename from tests/Engine/Network/TCPTest.cpp rename to tests/UnitTests/Engine/Network/TCPTest.cpp diff --git a/tests/Engine/Network/UdpSocketTest.cpp b/tests/UnitTests/Engine/Network/UdpSocketTest.cpp similarity index 100% rename from tests/Engine/Network/UdpSocketTest.cpp rename to tests/UnitTests/Engine/Network/UdpSocketTest.cpp diff --git a/tests/Engine/Physics2D/Collider2DTest.cpp b/tests/UnitTests/Engine/Physics2D/Collider2DTest.cpp similarity index 100% rename from tests/Engine/Physics2D/Collider2DTest.cpp rename to tests/UnitTests/Engine/Physics2D/Collider2DTest.cpp diff --git a/tests/Engine/Physics2D/PhysWorld2DTest.cpp b/tests/UnitTests/Engine/Physics2D/PhysWorld2DTest.cpp similarity index 100% rename from tests/Engine/Physics2D/PhysWorld2DTest.cpp rename to tests/UnitTests/Engine/Physics2D/PhysWorld2DTest.cpp diff --git a/tests/Engine/Physics2D/RigidBody2DTest.cpp b/tests/UnitTests/Engine/Physics2D/RigidBody2DTest.cpp similarity index 100% rename from tests/Engine/Physics2D/RigidBody2DTest.cpp rename to tests/UnitTests/Engine/Physics2D/RigidBody2DTest.cpp diff --git a/tests/Engine/Utility/FontLoading.cpp b/tests/UnitTests/Engine/Utility/FontLoading.cpp similarity index 100% rename from tests/Engine/Utility/FontLoading.cpp rename to tests/UnitTests/Engine/Utility/FontLoading.cpp diff --git a/tests/Engine/Utility/ImageLoading.cpp b/tests/UnitTests/Engine/Utility/ImageLoading.cpp similarity index 100% rename from tests/Engine/Utility/ImageLoading.cpp rename to tests/UnitTests/Engine/Utility/ImageLoading.cpp diff --git a/tests/Engine/Utility/ImageStreamLoading.cpp b/tests/UnitTests/Engine/Utility/ImageStreamLoading.cpp similarity index 100% rename from tests/Engine/Utility/ImageStreamLoading.cpp rename to tests/UnitTests/Engine/Utility/ImageStreamLoading.cpp diff --git a/tests/Engine/Utility/MeshLoading.cpp b/tests/UnitTests/Engine/Utility/MeshLoading.cpp similarity index 100% rename from tests/Engine/Utility/MeshLoading.cpp rename to tests/UnitTests/Engine/Utility/MeshLoading.cpp diff --git a/tests/main.cpp b/tests/UnitTests/main.cpp similarity index 100% rename from tests/main.cpp rename to tests/UnitTests/main.cpp diff --git a/tests/resources.cpp b/tests/UnitTests/resources.cpp similarity index 100% rename from tests/resources.cpp rename to tests/UnitTests/resources.cpp diff --git a/tests/UnitTests/xmake.lua b/tests/UnitTests/xmake.lua new file mode 100644 index 000000000..ebf8f4d13 --- /dev/null +++ b/tests/UnitTests/xmake.lua @@ -0,0 +1,25 @@ +add_requires("catch2 >=3.x") + +if is_mode("asan") then + add_defines("CATCH_CONFIG_NO_WINDOWS_SEH") + add_defines("CATCH_CONFIG_NO_POSIX_SIGNALS") +end + +add_deps("NazaraAudio", "NazaraCore", "NazaraNetwork", "NazaraPhysics2D") +add_packages("catch2", "entt") +add_headerfiles("Engine/**.hpp", { prefixdir = "private", install = false }) +add_files("resources.cpp") +add_files("Engine/**.cpp") +add_includedirs(".") + +if has_config("unitybuild") then + add_rules("c++.unity_build") +end + +target("UnitTests", function () + add_files("main.cpp", {unity_ignored = true}) + + if has_config("usepch") then + set_pcxxheader("Engine/Modules.hpp") + end +end) diff --git a/tests/xmake.lua b/tests/xmake.lua index 3a5e4ee36..3982876b3 100644 --- a/tests/xmake.lua +++ b/tests/xmake.lua @@ -1,33 +1,7 @@ -option("tests", { description = "Build unit tests", default = false }) +option("tests", { description = "Build tests", default = true }) if has_config("tests") then - if is_mode("asan") then - add_defines("CATCH_CONFIG_NO_WINDOWS_SEH") - add_defines("CATCH_CONFIG_NO_POSIX_SIGNALS") - end - - add_requires("catch2 3") - - -- Common config set_group("Tests") - set_kind("binary") - add_deps("NazaraAudio", "NazaraCore", "NazaraNetwork", "NazaraPhysics2D") - add_packages("catch2", "entt") - add_headerfiles("Engine/**.hpp", { prefixdir = "private", install = false }) - add_files("resources.cpp") - add_files("Engine/**.cpp") - add_includedirs(".") - - if has_config("unitybuild") then - add_rules("c++.unity_build") - end - - target("NazaraUnitTests", function () - add_files("main.cpp", {unity_ignored = true}) - - if has_config("usepch") then - set_pcxxheader("Engine/Modules.hpp") - end - end) + includes("*/xmake.lua") end