Remove vendored doctest header

This commit is contained in:
Chris Thrasher 2022-07-17 16:18:40 -06:00 committed by Lukas Dürrenberger
parent 97537d36b3
commit a47eb8320a
31 changed files with 48 additions and 7059 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,12 @@
include(FetchContent)
set(DOCTEST_NO_INSTALL ON)
FetchContent_Declare(doctest
GIT_REPOSITORY "https://github.com/doctest/doctest.git"
GIT_TAG v2.4.9
)
FetchContent_MakeAvailable(doctest)
add_library(sfml-test-main STATIC add_library(sfml-test-main STATIC
DoctestMain.cpp DoctestMain.cpp
TestUtilities/SystemUtil.hpp TestUtilities/SystemUtil.hpp
@ -7,10 +16,9 @@ add_library(sfml-test-main STATIC
TestUtilities/GraphicsUtil.hpp TestUtilities/GraphicsUtil.hpp
TestUtilities/GraphicsUtil.cpp TestUtilities/GraphicsUtil.cpp
) )
target_include_directories(sfml-test-main SYSTEM PUBLIC "${PROJECT_SOURCE_DIR}/extlibs/headers")
target_include_directories(sfml-test-main PUBLIC TestUtilities) target_include_directories(sfml-test-main PUBLIC TestUtilities)
target_compile_definitions(sfml-test-main PUBLIC DOCTEST_CONFIG_REQUIRE_STRINGIFICATION_FOR_ALL_USED_TYPES) target_compile_definitions(sfml-test-main PUBLIC DOCTEST_CONFIG_REQUIRE_STRINGIFICATION_FOR_ALL_USED_TYPES)
target_link_libraries(sfml-test-main PUBLIC SFML::System) target_link_libraries(sfml-test-main PUBLIC SFML::System doctest::doctest)
set_target_warnings(sfml-test-main) set_target_warnings(sfml-test-main)
SET(SYSTEM_SRC SET(SYSTEM_SRC

View File

@ -1,2 +1,2 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest.h> #include <doctest/doctest.h>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/BlendMode.hpp> #include <SFML/Graphics/BlendMode.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/CircleShape.hpp> #include <SFML/Graphics/CircleShape.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
@ -9,7 +9,7 @@ TEST_CASE("sf::CircleShape class - [graphics]")
SUBCASE("Default constructor") SUBCASE("Default constructor")
{ {
const sf::CircleShape circle; const sf::CircleShape circle;
CHECK(circle.getRadius() == 0); CHECK(circle.getRadius() == 0.f);
CHECK(circle.getPointCount() == 30); CHECK(circle.getPointCount() == 30);
for (std::size_t i = 0; i < circle.getPointCount(); ++i) for (std::size_t i = 0; i < circle.getPointCount(); ++i)
CHECK(circle.getPoint(i) == sf::Vector2f(0, 0)); CHECK(circle.getPoint(i) == sf::Vector2f(0, 0));

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/Color.hpp> #include <SFML/Graphics/Color.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/ConvexShape.hpp> #include <SFML/Graphics/ConvexShape.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/Glyph.hpp> #include <SFML/Graphics/Glyph.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
@ -9,7 +9,7 @@ TEST_CASE("sf::Glyph class - [graphics]")
SUBCASE("Construction") SUBCASE("Construction")
{ {
const sf::Glyph glyph; const sf::Glyph glyph;
CHECK(glyph.advance == 0); CHECK(glyph.advance == 0.f);
CHECK(glyph.lsbDelta == 0); CHECK(glyph.lsbDelta == 0);
CHECK(glyph.rsbDelta == 0); CHECK(glyph.rsbDelta == 0);
CHECK(glyph.bounds == sf::FloatRect()); CHECK(glyph.bounds == sf::FloatRect());

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/Image.hpp> #include <SFML/Graphics/Image.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <array> #include <array>

View File

@ -1,7 +1,7 @@
#include <SFML/Graphics/Rect.hpp> #include <SFML/Graphics/Rect.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/RectangleShape.hpp> #include <SFML/Graphics/RectangleShape.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/RenderStates.hpp> #include <SFML/Graphics/RenderStates.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/Shape.hpp> #include <SFML/Graphics/Shape.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,7 +1,7 @@
#include <SFML/Graphics/Transform.hpp> #include <SFML/Graphics/Transform.hpp>
#include <SFML/System/Angle.hpp> #include <SFML/System/Angle.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <vector> #include <vector>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/Transformable.hpp> #include <SFML/Graphics/Transformable.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/Vertex.hpp> #include <SFML/Graphics/Vertex.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/VertexArray.hpp> #include <SFML/Graphics/VertexArray.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Graphics/View.hpp> #include <SFML/Graphics/View.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Network/IpAddress.hpp> #include <SFML/Network/IpAddress.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <sstream> #include <sstream>
#include <string_view> #include <string_view>

View File

@ -1,6 +1,6 @@
#include <SFML/Network.hpp> #include <SFML/Network.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <limits> #include <limits>

View File

@ -1,6 +1,6 @@
#include <SFML/System/Angle.hpp> #include <SFML/System/Angle.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
@ -11,8 +11,8 @@ TEST_CASE("sf::Angle class - [system]")
SUBCASE("Default constructor") SUBCASE("Default constructor")
{ {
const sf::Angle angle; const sf::Angle angle;
CHECK(angle.asDegrees() == 0); CHECK(angle.asDegrees() == 0.f);
CHECK(angle.asRadians() == 0); CHECK(angle.asRadians() == 0.f);
} }
SUBCASE("wrapSigned()") SUBCASE("wrapSigned()")
@ -80,8 +80,8 @@ TEST_CASE("sf::Angle class - [system]")
SUBCASE("Constants") SUBCASE("Constants")
{ {
CHECK(sf::Angle::Zero.asDegrees() == 0); CHECK(sf::Angle::Zero.asDegrees() == 0.f);
CHECK(sf::Angle::Zero.asRadians() == 0); CHECK(sf::Angle::Zero.asRadians() == 0.f);
} }
SUBCASE("Operators") SUBCASE("Operators")
@ -225,8 +225,8 @@ TEST_CASE("sf::Angle class - [system]")
CHECK(sf::degrees(10) / 2.5f == sf::degrees(4)); CHECK(sf::degrees(10) / 2.5f == sf::degrees(4));
CHECK(sf::radians(12) / 3 == sf::radians(4)); CHECK(sf::radians(12) / 3 == sf::radians(4));
CHECK(sf::Angle::Zero / sf::degrees(1) == 0); CHECK(sf::Angle::Zero / sf::degrees(1) == 0.f);
CHECK(sf::degrees(10) / sf::degrees(10) == 1); CHECK(sf::degrees(10) / sf::degrees(10) == 1.f);
CHECK(sf::radians(10) / sf::radians(2) == Approx(5.f)); CHECK(sf::radians(10) / sf::radians(2) == Approx(5.f));
} }

View File

@ -1,7 +1,7 @@
#include <SFML/System/Clock.hpp> #include <SFML/System/Clock.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <thread> #include <thread>

View File

@ -1,6 +1,6 @@
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <sstream> #include <sstream>

View File

@ -1,6 +1,6 @@
#include <SFML/System/FileInputStream.hpp> #include <SFML/System/FileInputStream.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <cassert> #include <cassert>
#include <fstream> #include <fstream>

View File

@ -1,6 +1,6 @@
#include <SFML/System/MemoryInputStream.hpp> #include <SFML/System/MemoryInputStream.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <ostream> #include <ostream>
#include <string_view> #include <string_view>

View File

@ -1,6 +1,6 @@
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
@ -162,7 +162,7 @@ TEST_CASE("sf::Time class - [system]")
CHECK(sf::seconds(1) / static_cast<sf::Int64>(2) == sf::seconds(0.5f)); CHECK(sf::seconds(1) / static_cast<sf::Int64>(2) == sf::seconds(0.5f));
CHECK(sf::seconds(42) / static_cast<sf::Int64>(2) == sf::seconds(21)); CHECK(sf::seconds(42) / static_cast<sf::Int64>(2) == sf::seconds(21));
CHECK(sf::seconds(1) / sf::seconds(1) == 1.0f); CHECK(sf::seconds(1) / sf::seconds(1) == 1.0f);
CHECK(sf::milliseconds(10) / sf::microseconds(1) == doctest::Approx(10'000.0).epsilon(1e-6)); CHECK(sf::milliseconds(10) / sf::microseconds(1) == Approx(10'000.f));
} }
SUBCASE("operator/=") SUBCASE("operator/=")

View File

@ -1,6 +1,6 @@
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <cmath> #include <cmath>

View File

@ -1,6 +1,6 @@
#include <SFML/System/Vector3.hpp> #include <SFML/System/Vector3.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <type_traits> #include <type_traits>

View File

@ -2,7 +2,7 @@
#include <SFML/System/String.hpp> #include <SFML/System/String.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <doctest.h> // for Approx #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Window/ContextSettings.hpp> #include <SFML/Window/ContextSettings.hpp>
#include <doctest.h> #include <doctest/doctest.h>
TEST_CASE("sf::ContextSettings class - [window]") TEST_CASE("sf::ContextSettings class - [window]")
{ {

View File

@ -1,6 +1,6 @@
#include <SFML/Window/VideoMode.hpp> #include <SFML/Window/VideoMode.hpp>
#include <doctest.h> #include <doctest/doctest.h>
#include <WindowUtil.hpp> #include <WindowUtil.hpp>