2022-01-22 18:11:08 -07:00
|
|
|
#include <SFML/System/Angle.hpp>
|
2018-08-19 01:30:53 +02:00
|
|
|
#include <SFML/System/String.hpp>
|
|
|
|
#include <SFML/System/Time.hpp>
|
2021-12-24 17:16:06 +01:00
|
|
|
|
2022-07-17 16:18:40 -06:00
|
|
|
#include <doctest/doctest.h>
|
2018-08-19 01:30:53 +02:00
|
|
|
|
2022-07-04 11:20:58 -05:00
|
|
|
#include <SystemUtil.hpp>
|
|
|
|
|
2021-12-24 14:31:27 +01:00
|
|
|
namespace sf
|
2018-08-19 01:30:53 +02:00
|
|
|
{
|
2022-07-04 23:46:34 -06:00
|
|
|
std::ostream& operator<<(std::ostream& os, const Angle& angle)
|
2022-07-04 11:20:58 -05:00
|
|
|
{
|
|
|
|
os << std::fixed << std::setprecision(std::numeric_limits<float>::max_digits10);
|
2022-07-04 23:57:04 -06:00
|
|
|
return os << angle.asDegrees() << " deg";
|
2022-07-04 11:20:58 -05:00
|
|
|
}
|
|
|
|
|
2022-07-04 23:46:34 -06:00
|
|
|
std::ostream& operator<<(std::ostream& os, const String& string)
|
2022-07-04 11:20:58 -05:00
|
|
|
{
|
2022-07-04 23:57:04 -06:00
|
|
|
return os << string.toAnsiString();
|
2022-07-04 11:20:58 -05:00
|
|
|
}
|
|
|
|
|
2022-07-04 23:46:34 -06:00
|
|
|
std::ostream& operator<<(std::ostream& os, Time time)
|
2022-07-04 11:20:58 -05:00
|
|
|
{
|
2022-07-04 23:57:04 -06:00
|
|
|
return os << time.asMicroseconds() << "us";
|
2018-08-19 01:30:53 +02:00
|
|
|
}
|
2022-07-04 11:20:58 -05:00
|
|
|
} // namespace sf
|
2021-12-24 17:16:06 +01:00
|
|
|
|
2022-05-02 16:38:33 -06:00
|
|
|
bool operator==(const float& lhs, const Approx<float>& rhs)
|
2022-05-04 18:03:26 +01:00
|
|
|
{
|
2022-05-02 16:38:33 -06:00
|
|
|
return static_cast<double>(lhs) == doctest::Approx(static_cast<double>(rhs.value));
|
2022-05-04 18:03:26 +01:00
|
|
|
}
|
|
|
|
|
2022-05-02 16:38:33 -06:00
|
|
|
bool operator==(const sf::Vector2f& lhs, const Approx<sf::Vector2f>& rhs)
|
2022-02-17 17:22:00 +01:00
|
|
|
{
|
2022-05-02 16:38:33 -06:00
|
|
|
return (lhs - rhs.value).length() == Approx(0.f);
|
2022-02-17 17:22:00 +01:00
|
|
|
}
|
|
|
|
|
2022-05-02 16:38:33 -06:00
|
|
|
bool operator==(const sf::Vector3f& lhs, const Approx<sf::Vector3f>& rhs)
|
2022-02-17 17:22:00 +01:00
|
|
|
{
|
2022-05-02 16:38:33 -06:00
|
|
|
return (lhs - rhs.value).length() == Approx(0.f);
|
2022-02-17 17:22:00 +01:00
|
|
|
}
|
|
|
|
|
2022-05-02 16:38:33 -06:00
|
|
|
bool operator==(const sf::Angle& lhs, const Approx<sf::Angle>& rhs)
|
2022-05-04 18:03:26 +01:00
|
|
|
{
|
2022-05-02 16:38:33 -06:00
|
|
|
return lhs.asDegrees() == Approx(rhs.value.asDegrees());
|
2022-02-17 17:22:00 +01:00
|
|
|
}
|