#include #include #include #include #include #include #include #include #include namespace sf { void setStreamPrecision(std::ostream& os, int maxDigits10) { os << std::fixed << std::setprecision(maxDigits10); } std::ostream& operator<<(std::ostream& os, const Angle& angle) { setStreamPrecision(os, std::numeric_limits::max_digits10); return os << angle.asDegrees() << " deg"; } std::ostream& operator<<(std::ostream& os, const String& string) { return os << string.toAnsiString(); } std::ostream& operator<<(std::ostream& os, Time time) { return os << time.asMicroseconds() << "us"; } template std::ostream& operator<<(std::ostream& os, const Vector2& vector) { setStreamPrecision(os, std::numeric_limits::max_digits10); return os << "(" << vector.x << ", " << vector.y << ")"; } template std::ostream& operator<<(std::ostream& os, const Vector3& vector) { setStreamPrecision(os, std::numeric_limits::max_digits10); return os << "(" << vector.x << ", " << vector.y << ", " << vector.z << ")"; } template std::ostream& operator<<(std::ostream&, const Vector2&); template std::ostream& operator<<(std::ostream&, const Vector2&); template std::ostream& operator<<(std::ostream&, const Vector2&); template std::ostream& operator<<(std::ostream&, const Vector3&); template std::ostream& operator<<(std::ostream&, const Vector3&); template std::ostream& operator<<(std::ostream&, const Vector3&); } // namespace sf bool operator==(const float& lhs, const Approx& rhs) { return static_cast(lhs) == Catch::Approx(static_cast(rhs.value)).margin(1e-5); } bool operator==(const sf::Vector2f& lhs, const Approx& rhs) { return (lhs - rhs.value).length() == Approx(0.f); } bool operator==(const sf::Vector3f& lhs, const Approx& rhs) { return (lhs - rhs.value).length() == Approx(0.f); } bool operator==(const sf::Angle& lhs, const Approx& rhs) { return lhs.asDegrees() == Approx(rhs.value.asDegrees()); }