Tests: Update Catch2 to 3.x
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/AbstractHash.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <Nazara/Core/ByteArray.hpp>
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
#include <variant>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/MemoryView.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <cstring>
|
||||
|
||||
SCENARIO("Buffering", "[CORE][BUFFERING]")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/ByteArray.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/ByteStream.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
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]")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
SCENARIO("Error", "[CORE][ERROR]")
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/Core/ObjectHandle.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
struct ObjectHandle_Test : public Nz::HandledObject<ObjectHandle_Test>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
class Test : public Nz::RefCounted
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/ParameterList.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
void nullAction(void*)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/PrimitiveList.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
SCENARIO("PrimitiveList", "[CORE][PRIMITIVELIST]")
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
SCENARIO("RefCounted", "[CORE][REFCOUNTED]")
|
||||
{
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
#include <Nazara/Math/Ray.hpp>
|
||||
#include <array>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
SCENARIO("Serialization", "[CORE][SERIALIZATION]")
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
SCENARIO("String", "[CORE][STRING]")
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Nazara/Core/Uuid.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <regex>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Core/VirtualDirectory.hpp>
|
||||
#include <Nazara/Core/Hash/SHA256.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <random>
|
||||
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
Reference in New Issue
Block a user