2015-04-29 03:37:01 +08:00
|
|
|
// Header for SFML unit tests.
|
|
|
|
//
|
2018-08-19 07:30:53 +08:00
|
|
|
// For a new system module test case, include this header and not <catch.hpp> directly.
|
2015-04-29 03:37:01 +08:00
|
|
|
// This ensures that string conversions are visible and can be used by Catch for debug output.
|
|
|
|
|
2018-08-19 07:30:53 +08:00
|
|
|
#ifndef SFML_TESTUTILITIES_SYSTEM_HPP
|
|
|
|
#define SFML_TESTUTILITIES_SYSTEM_HPP
|
|
|
|
|
2021-12-10 10:08:55 +08:00
|
|
|
#include <catch2/catch.hpp>
|
2015-04-29 03:37:01 +08:00
|
|
|
|
|
|
|
#include <SFML/System/Vector2.hpp>
|
|
|
|
#include <SFML/System/Vector3.hpp>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
// Forward declarations for non-template types
|
|
|
|
namespace sf
|
|
|
|
{
|
|
|
|
class String;
|
|
|
|
class Time;
|
|
|
|
}
|
|
|
|
|
|
|
|
// String conversions for Catch framework
|
|
|
|
namespace Catch
|
|
|
|
{
|
|
|
|
std::string toString(const sf::String& string);
|
|
|
|
std::string toString(sf::Time time);
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
std::string toString(const sf::Vector2<T>& vector)
|
|
|
|
{
|
|
|
|
std::ostringstream stream;
|
|
|
|
stream << "(" << vector.x << ", " << vector.y << ")";
|
|
|
|
return stream.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
std::string toString(const sf::Vector3<T>& vector)
|
|
|
|
{
|
|
|
|
std::ostringstream stream;
|
|
|
|
stream << "(" << vector.x << ", " << vector.y << ", " << vector.z << ")";
|
|
|
|
return stream.str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-19 07:30:53 +08:00
|
|
|
#endif // SFML_TESTUTILITIES_SYSTEM_HPP
|