diff --git a/tests/Engine/Audio/AlgorithmAudioTest.cpp b/tests/Engine/Audio/AlgorithmAudioTest.cpp index 5e175425a..4e71aeba3 100644 --- a/tests/Engine/Audio/AlgorithmAudioTest.cpp +++ b/tests/Engine/Audio/AlgorithmAudioTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include diff --git a/tests/Engine/Audio/MusicTest.cpp b/tests/Engine/Audio/MusicTest.cpp index af48805f7..0cad9480c 100644 --- a/tests/Engine/Audio/MusicTest.cpp +++ b/tests/Engine/Audio/MusicTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include #include #include diff --git a/tests/Engine/Audio/SoundBufferTest.cpp b/tests/Engine/Audio/SoundBufferTest.cpp index 40d92ec53..dcc776778 100644 --- a/tests/Engine/Audio/SoundBufferTest.cpp +++ b/tests/Engine/Audio/SoundBufferTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include std::filesystem::path GetAssetDir(); diff --git a/tests/Engine/Audio/SoundEmitterTest.cpp b/tests/Engine/Audio/SoundEmitterTest.cpp index 4061c1263..a7408e403 100644 --- a/tests/Engine/Audio/SoundEmitterTest.cpp +++ b/tests/Engine/Audio/SoundEmitterTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include std::filesystem::path GetAssetDir(); @@ -31,10 +32,10 @@ SCENARIO("SoundEmitter", "[AUDIO][SOUNDEMITTER]") sound.SetPitch(0.8f); sound.SetVolume(50.f); - REQUIRE(Approx(sound.GetAttenuation()) == 0.4f); - REQUIRE(Approx(sound.GetMinDistance()) == 40.f); - REQUIRE(Approx(sound.GetPitch()) == 0.8f); - REQUIRE(Approx(sound.GetVolume()) == 50.f); + REQUIRE(Catch::Approx(sound.GetAttenuation()) == 0.4f); + REQUIRE(Catch::Approx(sound.GetMinDistance()) == 40.f); + REQUIRE(Catch::Approx(sound.GetPitch()) == 0.8f); + REQUIRE(Catch::Approx(sound.GetVolume()) == 50.f); } } } diff --git a/tests/Engine/Audio/SoundStreamTest.cpp b/tests/Engine/Audio/SoundStreamTest.cpp index 58b7719d0..502340ece 100644 --- a/tests/Engine/Audio/SoundStreamTest.cpp +++ b/tests/Engine/Audio/SoundStreamTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include std::filesystem::path GetAssetDir(); diff --git a/tests/Engine/Audio/SoundTest.cpp b/tests/Engine/Audio/SoundTest.cpp index cb71dd737..b35c65bc2 100644 --- a/tests/Engine/Audio/SoundTest.cpp +++ b/tests/Engine/Audio/SoundTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include #include #include diff --git a/tests/Engine/Core/AbstractHashTest.cpp b/tests/Engine/Core/AbstractHashTest.cpp index 1b3d40476..345345d5a 100644 --- a/tests/Engine/Core/AbstractHashTest.cpp +++ b/tests/Engine/Core/AbstractHashTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include diff --git a/tests/Engine/Core/AlgorithmCoreTest.cpp b/tests/Engine/Core/AlgorithmCoreTest.cpp index ebccb0b46..5340ecb62 100644 --- a/tests/Engine/Core/AlgorithmCoreTest.cpp +++ b/tests/Engine/Core/AlgorithmCoreTest.cpp @@ -2,7 +2,8 @@ #include #include #include -#include +#include +#include #include #include #include diff --git a/tests/Engine/Core/BufferingTest.cpp b/tests/Engine/Core/BufferingTest.cpp index 6153e5f60..8f67fee5b 100644 --- a/tests/Engine/Core/BufferingTest.cpp +++ b/tests/Engine/Core/BufferingTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include SCENARIO("Buffering", "[CORE][BUFFERING]") diff --git a/tests/Engine/Core/ByteArrayTest.cpp b/tests/Engine/Core/ByteArrayTest.cpp index 10f5eefdd..540d7b12f 100644 --- a/tests/Engine/Core/ByteArrayTest.cpp +++ b/tests/Engine/Core/ByteArrayTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include diff --git a/tests/Engine/Core/ByteStreamTest.cpp b/tests/Engine/Core/ByteStreamTest.cpp index 461054ec0..c441ed6e9 100644 --- a/tests/Engine/Core/ByteStreamTest.cpp +++ b/tests/Engine/Core/ByteStreamTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include diff --git a/tests/Engine/Core/ClockTest.cpp b/tests/Engine/Core/ClockTest.cpp index 9bef540b6..9cac4806a 100644 --- a/tests/Engine/Core/ClockTest.cpp +++ b/tests/Engine/Core/ClockTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include #include diff --git a/tests/Engine/Core/ColorTest.cpp b/tests/Engine/Core/ColorTest.cpp index 37e16d025..f0070261a 100644 --- a/tests/Engine/Core/ColorTest.cpp +++ b/tests/Engine/Core/ColorTest.cpp @@ -1,14 +1,15 @@ #include -#include +#include +#include void CompareColor(const Nz::Color& lhs, const Nz::Color& rhs) { constexpr float epsilon = 0.1f; - REQUIRE(lhs.r == Approx(rhs.r).margin(epsilon)); - REQUIRE(lhs.g == Approx(rhs.g).margin(epsilon)); - REQUIRE(lhs.b == Approx(rhs.b).margin(epsilon)); - REQUIRE(lhs.a == Approx(rhs.a).margin(epsilon)); + REQUIRE(lhs.r == Catch::Approx(rhs.r).margin(epsilon)); + REQUIRE(lhs.g == Catch::Approx(rhs.g).margin(epsilon)); + REQUIRE(lhs.b == Catch::Approx(rhs.b).margin(epsilon)); + REQUIRE(lhs.a == Catch::Approx(rhs.a).margin(epsilon)); } constexpr float epsilon = 1.f; @@ -17,46 +18,46 @@ void CompareCMY(const Nz::Color& color, float cyan, float magenta, float yellow) { float retrievedCyan = 0.f, retrievedMagenta = 0.f, retrievedYellow = 0.f; Nz::Color::ToCMY(color, &retrievedCyan, &retrievedMagenta, &retrievedYellow); - CHECK(retrievedCyan == Approx(cyan).margin(epsilon)); - CHECK(retrievedMagenta == Approx(magenta).margin(epsilon)); - CHECK(retrievedYellow == Approx(yellow).margin(epsilon)); + CHECK(retrievedCyan == Catch::Approx(cyan).margin(epsilon)); + CHECK(retrievedMagenta == Catch::Approx(magenta).margin(epsilon)); + CHECK(retrievedYellow == Catch::Approx(yellow).margin(epsilon)); } void CompareCMYK(const Nz::Color& color, float cyan, float magenta, float yellow, float black) { float retrievedCyan = 0.f, retrievedMagenta = 0.f, retrievedYellow = 0.f, retrievedBlack = 0.f; Nz::Color::ToCMYK(color, &retrievedCyan, &retrievedMagenta, &retrievedYellow, &retrievedBlack); - CHECK(retrievedCyan == Approx(cyan).margin(epsilon)); - CHECK(retrievedMagenta == Approx(magenta).margin(epsilon)); - CHECK(retrievedYellow == Approx(yellow).margin(epsilon)); - CHECK(retrievedBlack == Approx(black).margin(epsilon)); + CHECK(retrievedCyan == Catch::Approx(cyan).margin(epsilon)); + CHECK(retrievedMagenta == Catch::Approx(magenta).margin(epsilon)); + CHECK(retrievedYellow == Catch::Approx(yellow).margin(epsilon)); + CHECK(retrievedBlack == Catch::Approx(black).margin(epsilon)); } void CompareHSL(const Nz::Color& color, float hue, float saturation, float luminosity) { float retrievedHue = 0.f, retrievedSaturation = 0.f, retrievedLuminosity = 0.f; Nz::Color::ToHSL(color, &retrievedHue, &retrievedSaturation, &retrievedLuminosity); - CHECK(retrievedHue == Approx(hue).margin(epsilon)); - CHECK(retrievedSaturation == Approx(saturation).margin(epsilon)); - CHECK(retrievedLuminosity == Approx(luminosity).margin(epsilon)); + CHECK(retrievedHue == Catch::Approx(hue).margin(epsilon)); + CHECK(retrievedSaturation == Catch::Approx(saturation).margin(epsilon)); + CHECK(retrievedLuminosity == Catch::Approx(luminosity).margin(epsilon)); } void CompareHSV(const Nz::Color& color, float hue, float saturation, float value) { float retrievedHue = 0.f, retrievedSaturation = 0.f, retrievedValue = 0.f; Nz::Color::ToHSV(color, &retrievedHue, &retrievedSaturation, &retrievedValue); - CHECK(retrievedHue == Approx(hue).margin(epsilon)); - CHECK(retrievedSaturation == Approx(saturation).margin(epsilon)); - CHECK(retrievedValue == Approx(value).margin(epsilon)); + CHECK(retrievedHue == Catch::Approx(hue).margin(epsilon)); + CHECK(retrievedSaturation == Catch::Approx(saturation).margin(epsilon)); + CHECK(retrievedValue == Catch::Approx(value).margin(epsilon)); } void CompareXYZ(const Nz::Color& color, float x, float y, float z) { Nz::Vector3f retrievedValues = Nz::Vector3f::Zero(); Nz::Color::ToXYZ(color, &retrievedValues); - CHECK(retrievedValues.x == Approx(x).margin(epsilon)); - CHECK(retrievedValues.y == Approx(y).margin(epsilon)); - CHECK(retrievedValues.z == Approx(z).margin(epsilon)); + CHECK(retrievedValues.x == Catch::Approx(x).margin(epsilon)); + CHECK(retrievedValues.y == Catch::Approx(y).margin(epsilon)); + CHECK(retrievedValues.z == Catch::Approx(z).margin(epsilon)); } SCENARIO("Color", "[CORE][COLOR]") diff --git a/tests/Engine/Core/ErrorTest.cpp b/tests/Engine/Core/ErrorTest.cpp index fb9cfd868..d1812a4bb 100644 --- a/tests/Engine/Core/ErrorTest.cpp +++ b/tests/Engine/Core/ErrorTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Error", "[CORE][ERROR]") { diff --git a/tests/Engine/Core/FileTest.cpp b/tests/Engine/Core/FileTest.cpp index 33d0833d0..944658645 100644 --- a/tests/Engine/Core/FileTest.cpp +++ b/tests/Engine/Core/FileTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include std::filesystem::path GetAssetDir(); diff --git a/tests/Engine/Core/ObjectHandleTest.cpp b/tests/Engine/Core/ObjectHandleTest.cpp index 90dda82f5..fc8afa987 100644 --- a/tests/Engine/Core/ObjectHandleTest.cpp +++ b/tests/Engine/Core/ObjectHandleTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include struct ObjectHandle_Test : public Nz::HandledObject { diff --git a/tests/Engine/Core/ObjectRefTest.cpp b/tests/Engine/Core/ObjectRefTest.cpp index 232af9075..f708c6d0b 100644 --- a/tests/Engine/Core/ObjectRefTest.cpp +++ b/tests/Engine/Core/ObjectRefTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include class Test : public Nz::RefCounted { diff --git a/tests/Engine/Core/ParameterListTest.cpp b/tests/Engine/Core/ParameterListTest.cpp index 3480308f1..cc4a81873 100644 --- a/tests/Engine/Core/ParameterListTest.cpp +++ b/tests/Engine/Core/ParameterListTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include void nullAction(void*) { diff --git a/tests/Engine/Core/PrimitiveListTest.cpp b/tests/Engine/Core/PrimitiveListTest.cpp index 2514802d4..5acf2c7a2 100644 --- a/tests/Engine/Core/PrimitiveListTest.cpp +++ b/tests/Engine/Core/PrimitiveListTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("PrimitiveList", "[CORE][PRIMITIVELIST]") { diff --git a/tests/Engine/Core/RefCountedTest.cpp b/tests/Engine/Core/RefCountedTest.cpp index 3b0270d1b..344e9d4af 100644 --- a/tests/Engine/Core/RefCountedTest.cpp +++ b/tests/Engine/Core/RefCountedTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("RefCounted", "[CORE][REFCOUNTED]") { diff --git a/tests/Engine/Core/SerializationTest.cpp b/tests/Engine/Core/SerializationTest.cpp index a88dc090d..95548dbac 100644 --- a/tests/Engine/Core/SerializationTest.cpp +++ b/tests/Engine/Core/SerializationTest.cpp @@ -7,7 +7,8 @@ #include #include -#include +#include +#include SCENARIO("Serialization", "[CORE][SERIALIZATION]") { diff --git a/tests/Engine/Core/StringExtTest.cpp b/tests/Engine/Core/StringExtTest.cpp index 618714b3f..d92ad4286 100644 --- a/tests/Engine/Core/StringExtTest.cpp +++ b/tests/Engine/Core/StringExtTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("String", "[CORE][STRING]") { diff --git a/tests/Engine/Core/UuidTest.cpp b/tests/Engine/Core/UuidTest.cpp index 752709dfd..7a0308a86 100644 --- a/tests/Engine/Core/UuidTest.cpp +++ b/tests/Engine/Core/UuidTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include #include #include diff --git a/tests/Engine/Core/VirtualDirectoryTest.cpp b/tests/Engine/Core/VirtualDirectoryTest.cpp index 4bfd25774..aa7975b02 100644 --- a/tests/Engine/Core/VirtualDirectoryTest.cpp +++ b/tests/Engine/Core/VirtualDirectoryTest.cpp @@ -3,7 +3,8 @@ #include #include #include -#include +#include +#include #include std::filesystem::path GetAssetDir(); diff --git a/tests/Engine/Math/AlgorithmMathTest.cpp b/tests/Engine/Math/AlgorithmMathTest.cpp index 36a9e94ea..2579f4182 100644 --- a/tests/Engine/Math/AlgorithmMathTest.cpp +++ b/tests/Engine/Math/AlgorithmMathTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include #include TEST_CASE("Approach", "[MATH][ALGORITHM]") @@ -61,7 +62,7 @@ TEST_CASE("DegreeToRadian", "[MATH][ALGORITHM]") { SECTION("Convert 45.f degree to radian") { - REQUIRE(Nz::DegreeToRadian(45.f) == Approx(Nz::Pi / 4.f)); + REQUIRE(Nz::DegreeToRadian(45.f) == Catch::Approx(Nz::Pi / 4.f)); } } @@ -323,7 +324,7 @@ TEST_CASE("RadianToDegree", "[MATH][ALGORITHM]") { SECTION("PI / 4 to degree") { - REQUIRE(Nz::RadianToDegree(Nz::Pi / 4.f) == Approx(45.f)); + REQUIRE(Nz::RadianToDegree(Nz::Pi / 4.f) == Catch::Approx(45.f)); } } diff --git a/tests/Engine/Math/AngleTest.cpp b/tests/Engine/Math/AngleTest.cpp index efafcdab3..5b764c597 100644 --- a/tests/Engine/Math/AngleTest.cpp +++ b/tests/Engine/Math/AngleTest.cpp @@ -1,7 +1,8 @@ #include #include #include -#include +#include +#include SCENARIO("Angle", "[MATH][ANGLE]") { @@ -36,8 +37,8 @@ SCENARIO("Angle", "[MATH][ANGLE]") { THEN("It should be equal to 1 and 0") { - CHECK(angle.GetSin() == Approx(1.f).margin(0.0001f)); - CHECK(angle.GetCos() == Approx(0.f).margin(0.0001f)); + CHECK(angle.GetSin() == Catch::Approx(1.f).margin(0.0001f)); + CHECK(angle.GetCos() == Catch::Approx(0.f).margin(0.0001f)); } AND_WHEN("We compute sin/cos at the same time") { @@ -45,8 +46,8 @@ SCENARIO("Angle", "[MATH][ANGLE]") THEN("It should also be equal to 1 and 0") { - CHECK(sincos.first == Approx(1.f).margin(0.0001f)); - CHECK(sincos.second == Approx(0.f).margin(0.0001f)); + CHECK(sincos.first == Catch::Approx(1.f).margin(0.0001f)); + CHECK(sincos.second == Catch::Approx(0.f).margin(0.0001f)); } } } @@ -135,8 +136,8 @@ SCENARIO("Angle", "[MATH][ANGLE]") { THEN("It should be equal to 0 and -1") { - CHECK(angle.GetSin() == Approx(0.f).margin(0.0001f)); - CHECK(angle.GetCos() == Approx(-1.f).margin(0.0001f)); + CHECK(angle.GetSin() == Catch::Approx(0.f).margin(0.0001f)); + CHECK(angle.GetCos() == Catch::Approx(-1.f).margin(0.0001f)); } } @@ -146,8 +147,8 @@ SCENARIO("Angle", "[MATH][ANGLE]") THEN("It should also be equal to 0 and -1") { - CHECK(sincos.first == Approx(0.f).margin(0.0001f)); - CHECK(sincos.second == Approx(-1.f).margin(0.0001f)); + CHECK(sincos.first == Catch::Approx(0.f).margin(0.0001f)); + CHECK(sincos.second == Catch::Approx(-1.f).margin(0.0001f)); } } diff --git a/tests/Engine/Math/BoundingVolumeTest.cpp b/tests/Engine/Math/BoundingVolumeTest.cpp index 09b1c33f9..8d4b9c2ac 100644 --- a/tests/Engine/Math/BoundingVolumeTest.cpp +++ b/tests/Engine/Math/BoundingVolumeTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("BoundingVolume", "[MATH][BOUNDINGVOLUME]") { diff --git a/tests/Engine/Math/BoxTest.cpp b/tests/Engine/Math/BoxTest.cpp index def3e4aa2..db2f3f777 100644 --- a/tests/Engine/Math/BoxTest.cpp +++ b/tests/Engine/Math/BoxTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Box", "[MATH][BOX]") { @@ -40,9 +41,9 @@ SCENARIO("Box", "[MATH][BOX]") REQUIRE(firstCenterAndUnit.GetNegativeVertex(Nz::Vector3f::Unit()) == Nz::Vector3f::Zero()); REQUIRE(firstCenterAndUnit.GetPosition() == Nz::Vector3f::Zero()); REQUIRE(firstCenterAndUnit.GetPositiveVertex(Nz::Vector3f::Unit()) == Nz::Vector3f::Unit()); - REQUIRE(firstCenterAndUnit.GetRadius() == Approx(std::sqrt(3.f * 0.5f * 0.5f))); + REQUIRE(firstCenterAndUnit.GetRadius() == Catch::Approx(std::sqrt(3.f * 0.5f * 0.5f))); REQUIRE(firstCenterAndUnit.GetSquaredBoundingSphere() == Nz::Spheref(Nz::Vector3f::Unit() * 0.5f, 3.f * 0.5f * 0.5f)); - REQUIRE(firstCenterAndUnit.GetSquaredRadius() == Approx(3.f * 0.5f * 0.5f)); + REQUIRE(firstCenterAndUnit.GetSquaredRadius() == Catch::Approx(3.f * 0.5f * 0.5f)); } } diff --git a/tests/Engine/Math/EulerAnglesTest.cpp b/tests/Engine/Math/EulerAnglesTest.cpp index ede4a07b6..c2d91fd87 100644 --- a/tests/Engine/Math/EulerAnglesTest.cpp +++ b/tests/Engine/Math/EulerAnglesTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include SCENARIO("EulerAngles", "[MATH][EULERANGLES]") { @@ -88,19 +89,19 @@ SCENARIO("EulerAngles", "[MATH][EULERANGLES]") THEN("And then convert to euler angles, we have identity") { Nz::EulerAnglesf tmp = Nz::Quaternionf(euler45.ToQuaternion()).ToEulerAngles(); - CHECK(tmp.pitch.ToDegrees() == Approx(0.f)); - CHECK(tmp.yaw.ToDegrees() == Approx(22.5f)); - CHECK(tmp.roll.ToDegrees() == Approx(22.5f)); + CHECK(tmp.pitch.ToDegrees() == Catch::Approx(0.f)); + CHECK(tmp.yaw.ToDegrees() == Catch::Approx(22.5f)); + CHECK(tmp.roll.ToDegrees() == Catch::Approx(22.5f)); tmp = Nz::Quaternionf(euler90.ToQuaternion()).ToEulerAngles(); - CHECK(tmp.pitch.ToDegrees() == Approx(90.f)); - CHECK(tmp.yaw.ToDegrees() == Approx(90.f)); - CHECK(tmp.roll.ToDegrees() == Approx(0.f)); + CHECK(tmp.pitch.ToDegrees() == Catch::Approx(90.f)); + CHECK(tmp.yaw.ToDegrees() == Catch::Approx(90.f)); + CHECK(tmp.roll.ToDegrees() == Catch::Approx(0.f)); tmp = Nz::Quaternionf(euler30.ToQuaternion()).ToEulerAngles(); - CHECK(tmp.pitch.ToDegrees() == Approx(30.f)); - CHECK(tmp.yaw.ToDegrees() == Approx(0.f).margin(0.0001f)); - CHECK(tmp.roll.ToDegrees() == Approx(30.f)); + CHECK(tmp.pitch.ToDegrees() == Catch::Approx(30.f)); + CHECK(tmp.yaw.ToDegrees() == Catch::Approx(0.f).margin(0.0001f)); + CHECK(tmp.roll.ToDegrees() == Catch::Approx(30.f)); } } } diff --git a/tests/Engine/Math/FrustumTest.cpp b/tests/Engine/Math/FrustumTest.cpp index 4b26ebf65..d8a813161 100644 --- a/tests/Engine/Math/FrustumTest.cpp +++ b/tests/Engine/Math/FrustumTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Frustum", "[MATH][FRUSTUM]") { diff --git a/tests/Engine/Math/Matrix4Test.cpp b/tests/Engine/Math/Matrix4Test.cpp index fec0c6474..157189c97 100644 --- a/tests/Engine/Math/Matrix4Test.cpp +++ b/tests/Engine/Math/Matrix4Test.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include @@ -67,8 +68,8 @@ SCENARIO("Matrix4", "[MATH][MATRIX4]") { THEN("These results are expected") { - CHECK(matrix1.GetDeterminant() == Approx(24.f)); - CHECK(matrix2.GetDeterminant() == Approx(-1.f)); + CHECK(matrix1.GetDeterminant() == Catch::Approx(24.f)); + CHECK(matrix2.GetDeterminant() == Catch::Approx(-1.f)); } } @@ -83,8 +84,8 @@ SCENARIO("Matrix4", "[MATH][MATRIX4]") THEN("We get the identity") { Nz::Matrix4f tmp = matrix1 * invMatrix1; - CHECK(tmp.m32 == Approx(0.f).margin(0.0001f)); - CHECK(tmp.m42 == Approx(0.f).margin(0.0001f)); + CHECK(tmp.m32 == Catch::Approx(0.f).margin(0.0001f)); + CHECK(tmp.m42 == Catch::Approx(0.f).margin(0.0001f)); tmp.m32 = 0.f; tmp.m42 = 0.f; CHECK(tmp == Nz::Matrix4f::Identity()); @@ -215,9 +216,9 @@ SCENARIO("Matrix4", "[MATH][MATRIX4]") { identity.ApplyRotation(Nz::EulerAnglesf(Nz::DegreeAnglef(10.f), Nz::DegreeAnglef(20.f), Nz::DegreeAnglef(30.f))); Nz::Vector3f retrievedScale = identity.GetScale(); - CHECK(retrievedScale.x == Approx(scale.x)); - CHECK(retrievedScale.y == Approx(scale.y)); - CHECK(retrievedScale.z == Approx(scale.z)); + CHECK(retrievedScale.x == Catch::Approx(scale.x)); + CHECK(retrievedScale.y == Catch::Approx(scale.y)); + CHECK(retrievedScale.z == Catch::Approx(scale.z)); } } } @@ -233,7 +234,7 @@ SCENARIO("Matrix4", "[MATH][MATRIX4]") { THEN("We expect those to be true") { - CHECK(negativeDeterminant.GetDeterminant() == Approx(-1.f)); + CHECK(negativeDeterminant.GetDeterminant() == Catch::Approx(-1.f)); CHECK(!negativeDeterminant.HasScale()); CHECK(negativeDeterminant.HasNegativeScale()); } diff --git a/tests/Engine/Math/OrientedBoxTest.cpp b/tests/Engine/Math/OrientedBoxTest.cpp index e45f1bb7b..01a31b8d9 100644 --- a/tests/Engine/Math/OrientedBoxTest.cpp +++ b/tests/Engine/Math/OrientedBoxTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("OrientedBox", "[MATH][ORIENTEDBOX]") { diff --git a/tests/Engine/Math/PlaneTest.cpp b/tests/Engine/Math/PlaneTest.cpp index 2ea12724e..92969ca4e 100644 --- a/tests/Engine/Math/PlaneTest.cpp +++ b/tests/Engine/Math/PlaneTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Plane", "[MATH][PLANE]") { @@ -23,30 +24,30 @@ SCENARIO("Plane", "[MATH][PLANE]") AND_THEN("They have the same distance from the same point") { Nz::Vector3f point(-2.f, 3.f, 1.f); - REQUIRE(firstPlane.Distance(point) == Approx(secondPlane.Distance(point))); - REQUIRE(firstPlane.Distance(-2.f, 3.f, 1.f) == Approx(0.1547f)); + REQUIRE(firstPlane.Distance(point) == Catch::Approx(secondPlane.Distance(point))); + REQUIRE(firstPlane.Distance(-2.f, 3.f, 1.f) == Catch::Approx(0.1547f)); } AND_THEN("Distance between Plane (0, 1, 0), distance 1 and point (0, 2, 0) should be 1") { - REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 1.f).Distance(Nz::Vector3f::UnitY() * 2.f) == Approx(1.f)); + REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 1.f).Distance(Nz::Vector3f::UnitY() * 2.f) == Catch::Approx(1.f)); } AND_THEN("Distance between Plane (0, 1, 0), distance 5 and point (0, 2, 0) should be -3") { - REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 5.f).Distance(Nz::Vector3f::UnitY() * 2.f) == Approx(-3.f)); + REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 5.f).Distance(Nz::Vector3f::UnitY() * 2.f) == Catch::Approx(-3.f)); } AND_THEN("Distance between Plane (0, 1, 0), distance 1000 and point (0, 500, 0) and (0, 1500, 0)") { - REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 1000.f).Distance(Nz::Vector3f::UnitY() * 500.f) == Approx(-500.f)); - REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 1000.f).Distance(Nz::Vector3f::UnitY() * 1500.f) == Approx(500.f)); + REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 1000.f).Distance(Nz::Vector3f::UnitY() * 500.f) == Catch::Approx(-500.f)); + REQUIRE(Nz::Planef(Nz::Vector3f::UnitY(), 1000.f).Distance(Nz::Vector3f::UnitY() * 1500.f) == Catch::Approx(500.f)); } AND_THEN("Distance between Plane (0, -1, 0), distance -1000 and point (0, 500, 0) and (0, 1500, 0)") { - REQUIRE(Nz::Planef(-Nz::Vector3f::UnitY(), -1000.f).Distance(Nz::Vector3f::UnitY() * 500.f) == Approx(500.f)); - REQUIRE(Nz::Planef(-Nz::Vector3f::UnitY(), -1000.f).Distance(Nz::Vector3f::UnitY() * 1500.f) == Approx(-500.f)); + REQUIRE(Nz::Planef(-Nz::Vector3f::UnitY(), -1000.f).Distance(Nz::Vector3f::UnitY() * 500.f) == Catch::Approx(500.f)); + REQUIRE(Nz::Planef(-Nz::Vector3f::UnitY(), -1000.f).Distance(Nz::Vector3f::UnitY() * 1500.f) == Catch::Approx(-500.f)); } } diff --git a/tests/Engine/Math/QuaternionTest.cpp b/tests/Engine/Math/QuaternionTest.cpp index c43c9753a..44aca4b1d 100644 --- a/tests/Engine/Math/QuaternionTest.cpp +++ b/tests/Engine/Math/QuaternionTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Quaternion", "[MATH][QUATERNION]") { @@ -15,7 +16,7 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]") REQUIRE(firstQuaternion == secondQuaternion); REQUIRE(firstQuaternion.ComputeW() == secondQuaternion.Normalize()); REQUIRE(firstQuaternion.Conjugate() == secondQuaternion.Inverse()); - REQUIRE(firstQuaternion.DotProduct(secondQuaternion) == Approx(1.f)); + REQUIRE(firstQuaternion.DotProduct(secondQuaternion) == Catch::Approx(1.f)); } } @@ -45,7 +46,7 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]") REQUIRE(inverted == zero); REQUIRE(normalized == zero); - REQUIRE(tmp == Approx(0.f)); + REQUIRE(tmp == Catch::Approx(0.f)); } } } @@ -63,11 +64,11 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]") { THEN("They are all equal to 1") { - REQUIRE(w.Magnitude() == Approx(1.f)); - REQUIRE(x.Magnitude() == Approx(1.f)); - REQUIRE(y.Magnitude() == Approx(1.f)); - REQUIRE(z.Magnitude() == Approx(1.f)); - REQUIRE(xyzw.Magnitude() == Approx(1.f)); + REQUIRE(w.Magnitude() == Catch::Approx(1.f)); + REQUIRE(x.Magnitude() == Catch::Approx(1.f)); + REQUIRE(y.Magnitude() == Catch::Approx(1.f)); + REQUIRE(z.Magnitude() == Catch::Approx(1.f)); + REQUIRE(xyzw.Magnitude() == Catch::Approx(1.f)); } } @@ -144,15 +145,15 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]") THEN("The half of 10 and 30 is 20") { Nz::Quaternionf slerpx10x30a = Nz::Quaternionf::Slerp(x10, x30a, 0.5f); - REQUIRE(slerpx10x30a.w == Approx(x20.w)); - REQUIRE(slerpx10x30a.x == Approx(x20.x)); - REQUIRE(slerpx10x30a.y == Approx(x20.y)); - REQUIRE(slerpx10x30a.z == Approx(x20.z)); + REQUIRE(slerpx10x30a.w == Catch::Approx(x20.w)); + REQUIRE(slerpx10x30a.x == Catch::Approx(x20.x)); + REQUIRE(slerpx10x30a.y == Catch::Approx(x20.y)); + REQUIRE(slerpx10x30a.z == Catch::Approx(x20.z)); Nz::Quaternionf slerpx10x30b = Nz::Quaternionf::Slerp(x10, x30b, 0.5f); - REQUIRE(slerpx10x30b.w == Approx(x20.w)); - REQUIRE(slerpx10x30b.x == Approx(x20.x)); - REQUIRE(slerpx10x30b.y == Approx(x20.y)); - REQUIRE(slerpx10x30b.z == Approx(x20.z)); + REQUIRE(slerpx10x30b.w == Catch::Approx(x20.w)); + REQUIRE(slerpx10x30b.x == Catch::Approx(x20.x)); + REQUIRE(slerpx10x30b.y == Catch::Approx(x20.y)); + REQUIRE(slerpx10x30b.z == Catch::Approx(x20.z)); REQUIRE(Nz::Quaternionf::Slerp(x10, x30a, 0.f) == x10); REQUIRE(Nz::Quaternionf::Slerp(x10, x30a, 1.f) == x30a); } @@ -164,10 +165,10 @@ SCENARIO("Quaternion", "[MATH][QUATERNION]") Nz::Quaternionf quaternionC = Nz::Quaternionf::Slerp(quaterionA, quaterionB, 0.5f); Nz::Quaternionf unitZ225(Nz::DegreeAnglef(22.5f), Nz::Vector3f::UnitZ()); - REQUIRE(quaternionC.w == Approx(unitZ225.w)); - REQUIRE(quaternionC.x == Approx(unitZ225.x)); - REQUIRE(quaternionC.y == Approx(unitZ225.y)); - REQUIRE(quaternionC.z == Approx(unitZ225.z)); + REQUIRE(quaternionC.w == Catch::Approx(unitZ225.w)); + REQUIRE(quaternionC.x == Catch::Approx(unitZ225.x)); + REQUIRE(quaternionC.y == Catch::Approx(unitZ225.y)); + REQUIRE(quaternionC.z == Catch::Approx(unitZ225.z)); } } diff --git a/tests/Engine/Math/RayTest.cpp b/tests/Engine/Math/RayTest.cpp index c602b401e..3aee70762 100644 --- a/tests/Engine/Math/RayTest.cpp +++ b/tests/Engine/Math/RayTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Ray", "[MATH][RAY]") { @@ -21,7 +22,7 @@ SCENARIO("Ray", "[MATH][RAY]") { THEN("The point that is multiple on the Nz::Ray, is at multiple") { - REQUIRE(ray.ClosestPoint(secondRay.GetPoint(1.f)) == Approx(1.f)); + REQUIRE(ray.ClosestPoint(secondRay.GetPoint(1.f)) == Catch::Approx(1.f)); } } @@ -90,7 +91,7 @@ SCENARIO("Ray", "[MATH][RAY]") float tmpFurthest = -1.f; Nz::BoundingVolumef infiniteVolume(Nz::Extend::Infinite); CHECK(ray.Intersect(infiniteVolume, &tmpClosest, &tmpFurthest)); - CHECK(tmpClosest == Approx(0.f)); + CHECK(tmpClosest == Catch::Approx(0.f)); CHECK(tmpFurthest == std::numeric_limits::infinity()); } diff --git a/tests/Engine/Math/RectTest.cpp b/tests/Engine/Math/RectTest.cpp index f96f333a2..cf2533f79 100644 --- a/tests/Engine/Math/RectTest.cpp +++ b/tests/Engine/Math/RectTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Rect", "[MATH][RECT]") { diff --git a/tests/Engine/Math/SphereTest.cpp b/tests/Engine/Math/SphereTest.cpp index e8c5d89a0..48b1ed4bb 100644 --- a/tests/Engine/Math/SphereTest.cpp +++ b/tests/Engine/Math/SphereTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Sphere", "[MATH][SPHERE]") { @@ -41,10 +42,10 @@ SCENARIO("Sphere", "[MATH][SPHERE]") { THEN("These results are expected because we don't take into account the border") { - CHECK(firstCenterAndUnit.Distance(Nz::Vector3f::UnitX() * 2.f) == Approx(1.f)); + CHECK(firstCenterAndUnit.Distance(Nz::Vector3f::UnitX() * 2.f) == Catch::Approx(1.f)); Nz::Spheref tmp(Nz::Vector3f::UnitX(), 1.f); - CHECK(tmp.Distance(Nz::Vector3f::UnitX() * 4.f) == Approx(2.f)); + CHECK(tmp.Distance(Nz::Vector3f::UnitX() * 4.f) == Catch::Approx(2.f)); } } @@ -79,12 +80,12 @@ SCENARIO("Sphere", "[MATH][SPHERE]") firstCenterAndUnit.ExtendTo(point); - REQUIRE(firstCenterAndUnit.radius == Approx(2.f)); + REQUIRE(firstCenterAndUnit.radius == Catch::Approx(2.f)); THEN("Sphere must contain it and distance should be good") { CHECK(firstCenterAndUnit.Contains(point)); - CHECK(firstCenterAndUnit.Distance(point) == Approx(0.f)); + CHECK(firstCenterAndUnit.Distance(point) == Catch::Approx(0.f)); } } diff --git a/tests/Engine/Math/Vector2Test.cpp b/tests/Engine/Math/Vector2Test.cpp index 4c02b0f1d..881016c6b 100644 --- a/tests/Engine/Math/Vector2Test.cpp +++ b/tests/Engine/Math/Vector2Test.cpp @@ -1,4 +1,5 @@ -#include +#include +#include #include #include @@ -25,8 +26,8 @@ SCENARIO("Vector2", "[MATH][VECTOR2]") THEN("These are perpendicular") { - REQUIRE(firstUnit.AbsDotProduct(tmp) == Approx(2.f)); - REQUIRE(firstUnit.DotProduct(tmp) == Approx(0.f)); + REQUIRE(firstUnit.AbsDotProduct(tmp) == Catch::Approx(2.f)); + REQUIRE(firstUnit.DotProduct(tmp) == Catch::Approx(0.f)); REQUIRE(firstUnit.AngleBetween(tmp) == Nz::DegreeAnglef(90.f)); Nz::Vector2f negativeUnitX = -Nz::Vector2f::UnitX(); REQUIRE(negativeUnitX.AngleBetween(negativeUnitX + Nz::Vector2f(0, 0.0000001f)) == Nz::DegreeAnglef(360.f)); @@ -40,12 +41,12 @@ SCENARIO("Vector2", "[MATH][VECTOR2]") THEN("These are expected") { - REQUIRE(firstUnit.Distance(tmp2) == Approx(2.f * std::sqrt(2.f))); - REQUIRE(firstUnit.Distance(tmp) == Approx(5.f)); - REQUIRE(firstUnit.SquaredDistance(tmp) == Approx(25.f)); + REQUIRE(firstUnit.Distance(tmp2) == Catch::Approx(2.f * std::sqrt(2.f))); + REQUIRE(firstUnit.Distance(tmp) == Catch::Approx(5.f)); + REQUIRE(firstUnit.SquaredDistance(tmp) == Catch::Approx(25.f)); - REQUIRE(firstUnit.GetSquaredLength() == Approx(2.f)); - REQUIRE(firstUnit.GetLength() == Approx(std::sqrt(2.f))); + REQUIRE(firstUnit.GetSquaredLength() == Catch::Approx(2.f)); + REQUIRE(firstUnit.GetLength() == Catch::Approx(std::sqrt(2.f))); } } @@ -56,14 +57,14 @@ SCENARIO("Vector2", "[MATH][VECTOR2]") { Nz::Vector2f normalized = firstUnit.GetNormal(&ratio); REQUIRE(normalized == (Nz::Vector2f::Unit() / std::sqrt(2.f))); - REQUIRE(ratio == Approx(std::sqrt(2.f))); + REQUIRE(ratio == Catch::Approx(std::sqrt(2.f))); } THEN("For null vector") { Nz::Vector2f zero = Nz::Vector2f::Zero(); REQUIRE(zero.GetNormal(&ratio) == Nz::Vector2f::Zero()); - REQUIRE(ratio == Approx(0.f)); + REQUIRE(ratio == Catch::Approx(0.f)); } } diff --git a/tests/Engine/Math/Vector3Test.cpp b/tests/Engine/Math/Vector3Test.cpp index 427ead064..5952fba1d 100644 --- a/tests/Engine/Math/Vector3Test.cpp +++ b/tests/Engine/Math/Vector3Test.cpp @@ -1,4 +1,5 @@ -#include +#include +#include #include #include #include @@ -24,8 +25,8 @@ SCENARIO("Vector3", "[MATH][VECTOR3]") THEN("These results are expected") { - REQUIRE(firstUnit.AbsDotProduct(tmp) == Approx(2.f)); - REQUIRE(firstUnit.DotProduct(tmp) == Approx(0.f)); + REQUIRE(firstUnit.AbsDotProduct(tmp) == Catch::Approx(2.f)); + REQUIRE(firstUnit.DotProduct(tmp) == Catch::Approx(0.f)); REQUIRE(firstUnit.AngleBetween(tmp) == Nz::DegreeAnglef(90.f)); REQUIRE(firstUnit.AngleBetween(-firstUnit) == Nz::DegreeAnglef(180.f)); } @@ -46,11 +47,11 @@ SCENARIO("Vector3", "[MATH][VECTOR3]") THEN("These are expected") { - REQUIRE(firstUnit.Distance(tmp) == Approx(11.f)); - REQUIRE(firstUnit.SquaredDistance(tmp) == Approx(121.f)); + REQUIRE(firstUnit.Distance(tmp) == Catch::Approx(11.f)); + REQUIRE(firstUnit.SquaredDistance(tmp) == Catch::Approx(121.f)); - REQUIRE(firstUnit.GetSquaredLength() == Approx(3.f)); - REQUIRE(firstUnit.GetLength() == Approx(std::sqrt(3.f))); + REQUIRE(firstUnit.GetSquaredLength() == Catch::Approx(3.f)); + REQUIRE(firstUnit.GetLength() == Catch::Approx(std::sqrt(3.f))); } } @@ -61,14 +62,14 @@ SCENARIO("Vector3", "[MATH][VECTOR3]") { Nz::Vector3f normalized = firstUnit.GetNormal(&ratio); REQUIRE(normalized == (Nz::Vector3f::Unit() / std::sqrt(3.f))); - REQUIRE(ratio == Approx(std::sqrt(3.f))); + REQUIRE(ratio == Catch::Approx(std::sqrt(3.f))); } THEN("For null vector") { Nz::Vector3f zero = Nz::Vector3f::Zero(); REQUIRE(zero.GetNormal(&ratio) == Nz::Vector3f::Zero()); - REQUIRE(ratio == Approx(0.f)); + REQUIRE(ratio == Catch::Approx(0.f)); } } diff --git a/tests/Engine/Math/Vector4Test.cpp b/tests/Engine/Math/Vector4Test.cpp index 76554737b..a1b5b7fd6 100644 --- a/tests/Engine/Math/Vector4Test.cpp +++ b/tests/Engine/Math/Vector4Test.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include @@ -24,8 +25,8 @@ SCENARIO("Vector4", "[MATH][VECTOR4]") THEN("These results are expected") { - REQUIRE(firstUnit.AbsDotProduct(tmp) == Approx(2.f)); - REQUIRE(firstUnit.DotProduct(tmp) == Approx(0.f)); + REQUIRE(firstUnit.AbsDotProduct(tmp) == Catch::Approx(2.f)); + REQUIRE(firstUnit.DotProduct(tmp) == Catch::Approx(0.f)); } } diff --git a/tests/Engine/Network/IpAddressTest.cpp b/tests/Engine/Network/IpAddressTest.cpp index 4ab437a54..05a8eb0bf 100644 --- a/tests/Engine/Network/IpAddressTest.cpp +++ b/tests/Engine/Network/IpAddressTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include SCENARIO("IpAddress", "[NETWORK][IPADDRESS]") { diff --git a/tests/Engine/Network/SocketPollerTest.cpp b/tests/Engine/Network/SocketPollerTest.cpp index 1ba14999c..48f091cc0 100644 --- a/tests/Engine/Network/SocketPollerTest.cpp +++ b/tests/Engine/Network/SocketPollerTest.cpp @@ -3,7 +3,8 @@ #include #include #include -#include +#include +#include #include SCENARIO("SocketPoller", "[NETWORK][SOCKETPOLLER]") diff --git a/tests/Engine/Network/TCPTest.cpp b/tests/Engine/Network/TCPTest.cpp index a8d5a4348..873c5468a 100644 --- a/tests/Engine/Network/TCPTest.cpp +++ b/tests/Engine/Network/TCPTest.cpp @@ -2,7 +2,8 @@ #include #include #include -#include +#include +#include #include #include diff --git a/tests/Engine/Network/UdpSocketTest.cpp b/tests/Engine/Network/UdpSocketTest.cpp index c933bd1f7..f969dc3a8 100644 --- a/tests/Engine/Network/UdpSocketTest.cpp +++ b/tests/Engine/Network/UdpSocketTest.cpp @@ -1,7 +1,8 @@ #include #include #include -#include +#include +#include SCENARIO("UdpSocket", "[NETWORK][UDPSOCKET]") { diff --git a/tests/Engine/Physics2D/Collider2DTest.cpp b/tests/Engine/Physics2D/Collider2DTest.cpp index 4f0e115ca..5bed2d431 100644 --- a/tests/Engine/Physics2D/Collider2DTest.cpp +++ b/tests/Engine/Physics2D/Collider2DTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include SCENARIO("Collider2D", "[PHYSICS2D][COLLIDER2D]") { @@ -40,7 +41,7 @@ SCENARIO("Collider2D", "[PHYSICS2D][COLLIDER2D]") THEN("We expect those to be true") { - CHECK(circle.GetRadius() == Approx(radius)); + CHECK(circle.GetRadius() == Catch::Approx(radius)); CHECK(circle.GetType() == Nz::ColliderType2D::Circle); } } @@ -98,7 +99,7 @@ SCENARIO("Collider2D", "[PHYSICS2D][COLLIDER2D]") THEN("We expect those to be true") { CHECK(segment.GetFirstPoint() == firstPoint); - CHECK(segment.GetLength() == Approx(firstPoint.Distance(secondPoint))); + CHECK(segment.GetLength() == Catch::Approx(firstPoint.Distance(secondPoint))); CHECK(segment.GetSecondPoint() == secondPoint); CHECK(segment.GetType() == Nz::ColliderType2D::Segment); } diff --git a/tests/Engine/Physics2D/PhysWorld2DTest.cpp b/tests/Engine/Physics2D/PhysWorld2DTest.cpp index f1772519a..96ff6db0f 100644 --- a/tests/Engine/Physics2D/PhysWorld2DTest.cpp +++ b/tests/Engine/Physics2D/PhysWorld2DTest.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include Nz::RigidBody2D CreateBody(Nz::PhysWorld2D& world, const Nz::Vector2f& position, bool isMoving = true, const Nz::Vector2f& lengths = Nz::Vector2f::Unit()); @@ -35,7 +36,7 @@ SCENARIO("PhysWorld2D", "[PHYSICS2D][PHYSWORLD2D]") CHECK(result.nearestBody == &bodies[0]); CHECK(result.closestPoint == Nz::Vector2f::Zero()); CHECK(result.fraction == -Nz::Vector2f::UnitY()); - CHECK(result.distance == Approx(1.f)); + CHECK(result.distance == Catch::Approx(1.f)); } REQUIRE(world.NearestBodyQuery(Nz::Vector2f::UnitY() * 2.f, 2.f, collisionGroup, categoryMask, collisionMask, &result)); @@ -45,7 +46,7 @@ SCENARIO("PhysWorld2D", "[PHYSICS2D][PHYSWORLD2D]") CHECK(result.nearestBody == &bodies[0]); CHECK(result.closestPoint == Nz::Vector2f::UnitY()); CHECK(result.fraction == Nz::Vector2f::UnitY()); - CHECK(result.distance == Approx(1.f)); + CHECK(result.distance == Catch::Approx(1.f)); } } @@ -59,7 +60,7 @@ SCENARIO("PhysWorld2D", "[PHYSICS2D][PHYSWORLD2D]") THEN("It should be the one on the origin") { CHECK(result.nearestBody == &bodies[0]); - CHECK(result.fraction == Approx(1.f / 42.f)); + CHECK(result.fraction == Catch::Approx(1.f / 42.f)); CHECK(result.hitPos == Nz::Vector2f::Zero()); CHECK(result.hitNormal == -Nz::Vector2f::UnitY()); } @@ -80,7 +81,7 @@ SCENARIO("PhysWorld2D", "[PHYSICS2D][PHYSWORLD2D]") { const Nz::PhysWorld2D::RaycastHit& result = results[i]; CHECK(result.nearestBody == &bodies[i]); - CHECK(result.fraction == Approx(i / 4.f).margin(0.1f)); + CHECK(result.fraction == Catch::Approx(i / 4.f).margin(0.1f)); CHECK(result.hitPos == Nz::Vector2f(0.f, i * 10.f)); CHECK(result.hitNormal == -Nz::Vector2f::UnitY()); } @@ -172,13 +173,13 @@ SCENARIO("PhysWorld2D", "[PHYSICS2D][PHYSWORLD2D]") world.Step(0.1f); CHECK(statusTriggerCollision == 11); - CHECK(character.GetPosition().x == Approx(3.1f).margin(0.01f)); + CHECK(character.GetPosition().x == Catch::Approx(3.1f).margin(0.01f)); for (int i = 0; i != 9; ++i) world.Step(0.1f); - CHECK(character.GetPosition().x == Approx(4.f).margin(0.01f)); + CHECK(character.GetPosition().x == Catch::Approx(4.f).margin(0.01f)); world.Step(0.1f); - CHECK(character.GetPosition().x == Approx(4.f).margin(0.01f)); + CHECK(character.GetPosition().x == Catch::Approx(4.f).margin(0.01f)); CHECK(statusWallCollision == 1); // It should be close to the wall character.SetVelocity(Nz::Vector2f(-2.f, 0.f)); diff --git a/tests/Engine/Physics2D/RigidBody2DTest.cpp b/tests/Engine/Physics2D/RigidBody2DTest.cpp index 36b6f7323..fa8a25ad6 100644 --- a/tests/Engine/Physics2D/RigidBody2DTest.cpp +++ b/tests/Engine/Physics2D/RigidBody2DTest.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include #include #include @@ -133,9 +134,9 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") CHECK(body.GetAngularVelocity() == 0.f); CHECK(body.GetMassCenter(Nz::CoordSys::Global) == position); CHECK(body.GetGeom() == box); - CHECK(body.GetMass() == Approx(mass)); + CHECK(body.GetMass() == Catch::Approx(mass)); CHECK(body.GetPosition() == position); - CHECK(body.GetRotation().value == Approx(0.f)); + CHECK(body.GetRotation().value == Catch::Approx(0.f)); CHECK(body.GetUserdata() == &userData); CHECK(body.GetVelocity() == Nz::Vector2f::Zero()); @@ -336,17 +337,17 @@ void EQUALITY(const Nz::RigidBody2D& left, const Nz::RigidBody2D& right) CHECK(left.GetMassCenter() == right.GetMassCenter()); CHECK(left.GetGeom() == right.GetGeom()); CHECK(left.GetHandle() != right.GetHandle()); - CHECK(left.GetMass() == Approx(right.GetMass())); + CHECK(left.GetMass() == Catch::Approx(right.GetMass())); CHECK(left.GetPosition() == right.GetPosition()); - CHECK(left.GetRotation().value == Approx(right.GetRotation().value)); + CHECK(left.GetRotation().value == Catch::Approx(right.GetRotation().value)); CHECK(left.GetUserdata() == right.GetUserdata()); CHECK(left.GetVelocity() == right.GetVelocity()); } void EQUALITY(const Nz::Rectf& left, const Nz::Rectf& right) { - CHECK(left.x == Approx(right.x)); - CHECK(left.y == Approx(right.y)); - CHECK(left.width == Approx(right.width)); - CHECK(left.height == Approx(right.height)); + CHECK(left.x == Catch::Approx(right.x)); + CHECK(left.y == Catch::Approx(right.y)); + CHECK(left.width == Catch::Approx(right.width)); + CHECK(left.height == Catch::Approx(right.height)); } diff --git a/tests/Engine/Utility/FontLoading.cpp b/tests/Engine/Utility/FontLoading.cpp index 81e83cb68..f5aeb1cbc 100644 --- a/tests/Engine/Utility/FontLoading.cpp +++ b/tests/Engine/Utility/FontLoading.cpp @@ -1,7 +1,8 @@ #include #include #include -#include +#include +#include #include #include @@ -28,14 +29,14 @@ SCENARIO("Fonts", "[Utility][Font]") const auto& sizeInfo24 = font->GetSizeInfo(24); CHECK(sizeInfo24.lineHeight == 33); CHECK(sizeInfo24.spaceAdvance == 6); - CHECK(sizeInfo24.underlinePosition == Approx(-2.40625f)); - CHECK(sizeInfo24.underlineThickness == Approx(1.20312f)); + CHECK(sizeInfo24.underlinePosition == Catch::Approx(-2.40625f)); + CHECK(sizeInfo24.underlineThickness == Catch::Approx(1.20312f)); const auto& sizeInfo72 = font->GetSizeInfo(72); CHECK(sizeInfo72.lineHeight == 98); CHECK(sizeInfo72.spaceAdvance == 19); - CHECK(sizeInfo72.underlinePosition == Approx(-7.20312f)); - CHECK(sizeInfo72.underlineThickness == Approx(3.59375f)); + CHECK(sizeInfo72.underlinePosition == Catch::Approx(-7.20312f)); + CHECK(sizeInfo72.underlineThickness == Catch::Approx(3.59375f)); } WHEN("Retrieving kerning") diff --git a/tests/Engine/Utility/ImageLoading.cpp b/tests/Engine/Utility/ImageLoading.cpp index 2ce9e5263..f33919d43 100644 --- a/tests/Engine/Utility/ImageLoading.cpp +++ b/tests/Engine/Utility/ImageLoading.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include std::filesystem::path GetAssetDir(); diff --git a/tests/Engine/Utility/ImageStreamLoading.cpp b/tests/Engine/Utility/ImageStreamLoading.cpp index 7d973072c..9a1aab4a9 100644 --- a/tests/Engine/Utility/ImageStreamLoading.cpp +++ b/tests/Engine/Utility/ImageStreamLoading.cpp @@ -1,7 +1,8 @@ #include #include #include -#include +#include +#include #include std::filesystem::path GetAssetDir(); diff --git a/tests/Engine/Utility/MeshLoading.cpp b/tests/Engine/Utility/MeshLoading.cpp index 9556f9fb5..14822719f 100644 --- a/tests/Engine/Utility/MeshLoading.cpp +++ b/tests/Engine/Utility/MeshLoading.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include #include std::filesystem::path GetAssetDir(); diff --git a/tests/main.cpp b/tests/main.cpp index 70e676213..961893300 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,5 +1,5 @@ #define CATCH_CONFIG_RUNNER -#include +#include #include #include diff --git a/tests/xmake.lua b/tests/xmake.lua index d882a6dc1..2d0926002 100644 --- a/tests/xmake.lua +++ b/tests/xmake.lua @@ -11,7 +11,7 @@ if has_config("tests") then add_defines("CATCH_CONFIG_NO_POSIX_SIGNALS") end - add_requires("catch2") + add_requires("catch2 3") -- Common config set_group("Tests")