// Header for SFML unit tests. // // For a new system module test case, include this header. // This ensures that string conversions are visible and can be used by Catch2 for debug output. #pragma once #include #include #include #include // String conversions for Catch2 namespace sf { class Angle; class String; class Time; template class Vector2; template class Vector3; void setStreamPrecision(std::ostream& os, int maxDigits10); std::ostream& operator<<(std::ostream& os, const Angle& angle); std::ostream& operator<<(std::ostream& os, const String& string); std::ostream& operator<<(std::ostream& os, Time time); template std::ostream& operator<<(std::ostream& os, Vector2 vector); template std::ostream& operator<<(std::ostream& os, const Vector3& vector); } // namespace sf //////////////////////////////////////////////////////////// /// Class template for creating custom approximate comparisons. /// To register a new type, simply implement a custom operator== /// overload for that type. //////////////////////////////////////////////////////////// template struct Approx { explicit Approx(const T& t) : value(t) { } const T& value; }; bool operator==(const float& lhs, const Approx& rhs); bool operator==(sf::Vector2 lhs, const Approx>& rhs); bool operator==(const sf::Vector3& lhs, const Approx>& rhs); bool operator==(const sf::Angle& lhs, const Approx& rhs); template std::ostream& operator<<(std::ostream& os, const Approx& approx) { return os << approx.value; } [[nodiscard]] std::vector loadIntoMemory(const std::filesystem::path& path);