Test existence of copy and move semantics

This commit is contained in:
Chris Thrasher 2022-07-25 00:36:05 -06:00
parent fd5c358c98
commit 9feef3708d
59 changed files with 460 additions and 2 deletions

View File

@ -0,0 +1,9 @@
#include <SFML/Audio/AlResource.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::AlResource>);
static_assert(!std::is_copy_constructible_v<sf::AlResource>);
static_assert(std::is_copy_assignable_v<sf::AlResource>);
static_assert(!std::is_nothrow_move_constructible_v<sf::AlResource>);
static_assert(std::is_nothrow_move_assignable_v<sf::AlResource>);

View File

View File

@ -0,0 +1,8 @@
#include <SFML/Audio/InputSoundFile.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::InputSoundFile>);
static_assert(!std::is_copy_assignable_v<sf::InputSoundFile>);
static_assert(!std::is_nothrow_move_constructible_v<sf::InputSoundFile>);
static_assert(!std::is_nothrow_move_assignable_v<sf::InputSoundFile>);

8
test/Audio/Music.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Audio/Music.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Music>);
static_assert(!std::is_copy_assignable_v<sf::Music>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Music>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Music>);

View File

@ -0,0 +1,8 @@
#include <SFML/Audio/OutputSoundFile.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::OutputSoundFile>);
static_assert(!std::is_copy_assignable_v<sf::OutputSoundFile>);
static_assert(!std::is_nothrow_move_constructible_v<sf::OutputSoundFile>);
static_assert(!std::is_nothrow_move_assignable_v<sf::OutputSoundFile>);

10
test/Audio/Sound.cpp Normal file
View File

@ -0,0 +1,10 @@
#include <SFML/Audio/Sound.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Sound>);
static_assert(std::is_copy_assignable_v<sf::Sound>);
static_assert(std::is_move_constructible_v<sf::Sound>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Sound>);
static_assert(std::is_move_assignable_v<sf::Sound>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Sound>);

View File

@ -0,0 +1,10 @@
#include <SFML/Audio/SoundBuffer.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::SoundBuffer>);
static_assert(std::is_copy_assignable_v<sf::SoundBuffer>);
static_assert(std::is_move_constructible_v<sf::SoundBuffer>);
static_assert(!std::is_nothrow_move_constructible_v<sf::SoundBuffer>);
static_assert(std::is_move_assignable_v<sf::SoundBuffer>);
static_assert(!std::is_nothrow_move_assignable_v<sf::SoundBuffer>);

View File

@ -0,0 +1,8 @@
#include <SFML/Audio/SoundBufferRecorder.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::SoundBufferRecorder>);
static_assert(!std::is_copy_assignable_v<sf::SoundBufferRecorder>);
static_assert(!std::is_nothrow_move_constructible_v<sf::SoundBufferRecorder>);
static_assert(!std::is_nothrow_move_assignable_v<sf::SoundBufferRecorder>);

View File

@ -0,0 +1,9 @@
#include <SFML/Audio/SoundRecorder.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::SoundRecorder>);
static_assert(!std::is_copy_constructible_v<sf::SoundRecorder>);
static_assert(!std::is_copy_assignable_v<sf::SoundRecorder>);
static_assert(!std::is_nothrow_move_constructible_v<sf::SoundRecorder>);
static_assert(!std::is_nothrow_move_assignable_v<sf::SoundRecorder>);

View File

@ -0,0 +1,10 @@
#include <SFML/Audio/SoundSource.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::SoundSource>);
static_assert(!std::is_copy_constructible_v<sf::SoundSource>);
static_assert(std::is_copy_assignable_v<sf::SoundSource>);
static_assert(!std::is_move_constructible_v<sf::SoundSource>);
static_assert(std::is_move_assignable_v<sf::SoundSource>);
static_assert(!std::is_nothrow_move_assignable_v<sf::SoundSource>);

View File

@ -0,0 +1,9 @@
#include <SFML/Audio/SoundStream.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::SoundStream>);
static_assert(!std::is_copy_constructible_v<sf::SoundStream>);
static_assert(!std::is_copy_assignable_v<sf::SoundStream>);
static_assert(!std::is_nothrow_move_constructible_v<sf::SoundStream>);
static_assert(!std::is_nothrow_move_assignable_v<sf::SoundStream>);

View File

@ -30,6 +30,7 @@ set(SYSTEM_SRC
System/Err.cpp System/Err.cpp
System/FileInputStream.cpp System/FileInputStream.cpp
System/MemoryInputStream.cpp System/MemoryInputStream.cpp
System/String.cpp
System/Time.cpp System/Time.cpp
System/Vector2.cpp System/Vector2.cpp
System/Vector3.cpp System/Vector3.cpp
@ -43,8 +44,13 @@ target_compile_definitions(test-sfml-system PRIVATE
) )
set(WINDOW_SRC set(WINDOW_SRC
Window/Context.cpp
Window/ContextSettings.cpp Window/ContextSettings.cpp
Window/Cursor.cpp
Window/GlResource.cpp
Window/VideoMode.cpp Window/VideoMode.cpp
Window/Window.cpp
Window/WindowBase.cpp
) )
sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window) sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window)
@ -53,28 +59,54 @@ set(GRAPHICS_SRC
Graphics/CircleShape.cpp Graphics/CircleShape.cpp
Graphics/Color.cpp Graphics/Color.cpp
Graphics/ConvexShape.cpp Graphics/ConvexShape.cpp
Graphics/Drawable.cpp
Graphics/Font.cpp
Graphics/Glyph.cpp Graphics/Glyph.cpp
Graphics/Image.cpp Graphics/Image.cpp
Graphics/Rect.cpp Graphics/Rect.cpp
Graphics/RectangleShape.cpp Graphics/RectangleShape.cpp
Graphics/Shape.cpp
Graphics/RenderStates.cpp Graphics/RenderStates.cpp
Graphics/RenderTarget.cpp
Graphics/RenderTexture.cpp
Graphics/RenderWindow.cpp
Graphics/Shader.cpp
Graphics/Shape.cpp
Graphics/Sprite.cpp
Graphics/Text.cpp
Graphics/Texture.cpp
Graphics/Transform.cpp Graphics/Transform.cpp
Graphics/Transformable.cpp Graphics/Transformable.cpp
Graphics/Vertex.cpp Graphics/Vertex.cpp
Graphics/VertexArray.cpp Graphics/VertexArray.cpp
Graphics/VertexBuffer.cpp
Graphics/View.cpp Graphics/View.cpp
) )
sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics) sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics)
set(NETWORK_SRC set(NETWORK_SRC
Network/Ftp.cpp
Network/Http.cpp
Network/IpAddress.cpp Network/IpAddress.cpp
Network/Packet.cpp Network/Packet.cpp
Network/Socket.cpp
Network/SocketSelector.cpp
Network/TcpListener.cpp
Network/TcpSocket.cpp
Network/UdpSocket.cpp
) )
sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network) sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network)
set(AUDIO_SRC set(AUDIO_SRC
Audio/Dummy.cpp # TODO: Remove when there are real tests Audio/AlResource.cpp
Audio/InputSoundFile.cpp
Audio/Music.cpp
Audio/OutputSoundFile.cpp
Audio/Sound.cpp
Audio/SoundBuffer.cpp
Audio/SoundBufferRecorder.cpp
Audio/SoundRecorder.cpp
Audio/SoundSource.cpp
Audio/SoundStream.cpp
) )
sfml_add_test(test-sfml-audio "${AUDIO_SRC}" SFML::Audio) sfml_add_test(test-sfml-audio "${AUDIO_SRC}" SFML::Audio)

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::BlendMode>);
static_assert(std::is_copy_assignable_v<sf::BlendMode>);
static_assert(std::is_nothrow_move_constructible_v<sf::BlendMode>);
static_assert(std::is_nothrow_move_assignable_v<sf::BlendMode>);
TEST_CASE("[Graphics] sf::BlendMode") TEST_CASE("[Graphics] sf::BlendMode")
{ {

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::CircleShape>);
static_assert(std::is_copy_assignable_v<sf::CircleShape>);
static_assert(std::is_move_constructible_v<sf::CircleShape>);
static_assert(std::is_move_assignable_v<sf::CircleShape>);
TEST_CASE("[Graphics] sf::CircleShape") TEST_CASE("[Graphics] sf::CircleShape")
{ {

View File

@ -3,8 +3,14 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
#include <vector> #include <vector>
static_assert(std::is_copy_constructible_v<sf::Color>);
static_assert(std::is_copy_assignable_v<sf::Color>);
static_assert(std::is_nothrow_move_constructible_v<sf::Color>);
static_assert(std::is_nothrow_move_assignable_v<sf::Color>);
TEST_CASE("[Graphics] sf::Color") TEST_CASE("[Graphics] sf::Color")
{ {
SUBCASE("Construction") SUBCASE("Construction")

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::ConvexShape>);
static_assert(std::is_copy_assignable_v<sf::ConvexShape>);
static_assert(std::is_move_constructible_v<sf::ConvexShape>);
static_assert(std::is_move_assignable_v<sf::ConvexShape>);
TEST_CASE("[Graphics] sf::ConvexShape") TEST_CASE("[Graphics] sf::ConvexShape")
{ {

View File

@ -0,0 +1,9 @@
#include <SFML/Graphics/Drawable.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::Drawable>);
static_assert(!std::is_copy_constructible_v<sf::Drawable>);
static_assert(std::is_copy_assignable_v<sf::Drawable>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Drawable>);
static_assert(std::is_nothrow_move_assignable_v<sf::Drawable>);

8
test/Graphics/Font.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Graphics/Font.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Font>);
static_assert(std::is_copy_assignable_v<sf::Font>);
static_assert(std::is_nothrow_move_constructible_v<sf::Font>);
static_assert(std::is_nothrow_move_assignable_v<sf::Font>);

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Glyph>);
static_assert(std::is_copy_assignable_v<sf::Glyph>);
static_assert(std::is_nothrow_move_constructible_v<sf::Glyph>);
static_assert(std::is_nothrow_move_assignable_v<sf::Glyph>);
TEST_CASE("[Graphics] sf::Glyph") TEST_CASE("[Graphics] sf::Glyph")
{ {

View File

@ -4,6 +4,12 @@
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <array> #include <array>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Image>);
static_assert(std::is_copy_assignable_v<sf::Image>);
static_assert(std::is_nothrow_move_constructible_v<sf::Image>);
static_assert(std::is_nothrow_move_assignable_v<sf::Image>);
TEST_CASE("[Graphics] sf::Image") TEST_CASE("[Graphics] sf::Image")
{ {

View File

@ -4,6 +4,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::IntRect>);
static_assert(std::is_copy_assignable_v<sf::IntRect>);
static_assert(std::is_nothrow_move_constructible_v<sf::IntRect>);
static_assert(std::is_nothrow_move_assignable_v<sf::IntRect>);
TEST_CASE("[Graphics] sf::Rect") TEST_CASE("[Graphics] sf::Rect")
{ {

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::RectangleShape>);
static_assert(std::is_copy_assignable_v<sf::RectangleShape>);
static_assert(std::is_move_constructible_v<sf::RectangleShape>);
static_assert(std::is_move_assignable_v<sf::RectangleShape>);
TEST_CASE("[Graphics] sf::RectangleShape") TEST_CASE("[Graphics] sf::RectangleShape")
{ {

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::RenderStates>);
static_assert(std::is_copy_assignable_v<sf::RenderStates>);
static_assert(std::is_nothrow_move_constructible_v<sf::RenderStates>);
static_assert(std::is_nothrow_move_assignable_v<sf::RenderStates>);
TEST_CASE("[Graphics] sf::RenderStates") TEST_CASE("[Graphics] sf::RenderStates")
{ {

View File

@ -0,0 +1,9 @@
#include <SFML/Graphics/RenderTarget.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::RenderTarget>);
static_assert(!std::is_copy_constructible_v<sf::RenderTarget>);
static_assert(!std::is_copy_assignable_v<sf::RenderTarget>);
static_assert(!std::is_nothrow_move_constructible_v<sf::RenderTarget>);
static_assert(!std::is_nothrow_move_assignable_v<sf::RenderTarget>);

View File

@ -0,0 +1,8 @@
#include <SFML/Graphics/RenderTexture.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::RenderTexture>);
static_assert(!std::is_copy_assignable_v<sf::RenderTexture>);
static_assert(!std::is_nothrow_move_constructible_v<sf::RenderTexture>);
static_assert(!std::is_nothrow_move_assignable_v<sf::RenderTexture>);

View File

@ -0,0 +1,8 @@
#include <SFML/Graphics/RenderWindow.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::RenderWindow>);
static_assert(!std::is_copy_assignable_v<sf::RenderWindow>);
static_assert(!std::is_nothrow_move_constructible_v<sf::RenderWindow>);
static_assert(!std::is_nothrow_move_assignable_v<sf::RenderWindow>);

8
test/Graphics/Shader.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Graphics/Shader.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Shader>);
static_assert(!std::is_copy_assignable_v<sf::Shader>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Shader>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Shader>);

View File

@ -3,6 +3,13 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::Shape>);
static_assert(!std::is_copy_constructible_v<sf::Shape>);
static_assert(std::is_copy_assignable_v<sf::Shape>);
static_assert(!std::is_move_constructible_v<sf::Shape>);
static_assert(std::is_move_assignable_v<sf::Shape>);
class TriangleShape : public sf::Shape class TriangleShape : public sf::Shape
{ {

8
test/Graphics/Sprite.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Graphics/Sprite.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Sprite>);
static_assert(std::is_copy_assignable_v<sf::Sprite>);
static_assert(std::is_nothrow_move_constructible_v<sf::Sprite>);
static_assert(std::is_nothrow_move_assignable_v<sf::Sprite>);

8
test/Graphics/Text.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Graphics/Text.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Text>);
static_assert(std::is_copy_assignable_v<sf::Text>);
static_assert(std::is_nothrow_move_constructible_v<sf::Text>);
static_assert(std::is_nothrow_move_assignable_v<sf::Text>);

10
test/Graphics/Texture.cpp Normal file
View File

@ -0,0 +1,10 @@
#include <SFML/Graphics/Texture.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Texture>);
static_assert(std::is_copy_assignable_v<sf::Texture>);
static_assert(std::is_move_constructible_v<sf::Texture>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Texture>);
static_assert(std::is_move_assignable_v<sf::Texture>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Texture>);

View File

@ -5,8 +5,14 @@
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <cassert> #include <cassert>
#include <type_traits>
#include <vector> #include <vector>
static_assert(std::is_copy_constructible_v<sf::Transform>);
static_assert(std::is_copy_assignable_v<sf::Transform>);
static_assert(std::is_nothrow_move_constructible_v<sf::Transform>);
static_assert(std::is_nothrow_move_assignable_v<sf::Transform>);
// Use StringMaker to avoid opening namespace std // Use StringMaker to avoid opening namespace std
namespace doctest namespace doctest
{ {

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Transformable>);
static_assert(std::is_copy_assignable_v<sf::Transformable>);
static_assert(std::is_nothrow_move_constructible_v<sf::Transformable>);
static_assert(std::is_nothrow_move_assignable_v<sf::Transformable>);
TEST_CASE("[Graphics] sf::Transformable") TEST_CASE("[Graphics] sf::Transformable")
{ {

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Vertex>);
static_assert(std::is_copy_assignable_v<sf::Vertex>);
static_assert(std::is_nothrow_move_constructible_v<sf::Vertex>);
static_assert(std::is_nothrow_move_assignable_v<sf::Vertex>);
TEST_CASE("[Graphics] sf::Vertex") TEST_CASE("[Graphics] sf::Vertex")
{ {

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::VertexArray>);
static_assert(std::is_copy_assignable_v<sf::VertexArray>);
static_assert(std::is_nothrow_move_constructible_v<sf::VertexArray>);
static_assert(std::is_nothrow_move_assignable_v<sf::VertexArray>);
TEST_CASE("[Graphics] sf::VertexArray") TEST_CASE("[Graphics] sf::VertexArray")
{ {

View File

@ -0,0 +1,10 @@
#include <SFML/Graphics/VertexBuffer.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::VertexBuffer>);
static_assert(std::is_copy_assignable_v<sf::VertexBuffer>);
static_assert(std::is_move_constructible_v<sf::VertexBuffer>);
static_assert(!std::is_nothrow_move_constructible_v<sf::VertexBuffer>);
static_assert(std::is_move_assignable_v<sf::VertexBuffer>);
static_assert(!std::is_nothrow_move_assignable_v<sf::VertexBuffer>);

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::View>);
static_assert(std::is_copy_assignable_v<sf::View>);
static_assert(std::is_nothrow_move_constructible_v<sf::View>);
static_assert(std::is_nothrow_move_assignable_v<sf::View>);
TEST_CASE("[Graphics] sf::View") TEST_CASE("[Graphics] sf::View")
{ {

8
test/Network/Ftp.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Network/Ftp.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Ftp>);
static_assert(!std::is_copy_assignable_v<sf::Ftp>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Ftp>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Ftp>);

8
test/Network/Http.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Network/Http.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Http>);
static_assert(!std::is_copy_assignable_v<sf::Http>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Http>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Http>);

View File

@ -4,10 +4,16 @@
#include <sstream> #include <sstream>
#include <string_view> #include <string_view>
#include <type_traits>
using namespace std::string_literals; using namespace std::string_literals;
using namespace std::string_view_literals; using namespace std::string_view_literals;
static_assert(std::is_copy_constructible_v<sf::IpAddress>);
static_assert(std::is_copy_assignable_v<sf::IpAddress>);
static_assert(std::is_nothrow_move_constructible_v<sf::IpAddress>);
static_assert(std::is_nothrow_move_assignable_v<sf::IpAddress>);
TEST_CASE("[Network] sf::IpAddress") TEST_CASE("[Network] sf::IpAddress")
{ {
SUBCASE("Construction") SUBCASE("Construction")

View File

@ -4,6 +4,12 @@
#include <array> #include <array>
#include <limits> #include <limits>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Packet>);
static_assert(std::is_copy_assignable_v<sf::Packet>);
static_assert(std::is_nothrow_move_constructible_v<sf::Packet>);
static_assert(std::is_nothrow_move_assignable_v<sf::Packet>);
#define CHECK_PACKET_STREAM_OPERATORS(expected) \ #define CHECK_PACKET_STREAM_OPERATORS(expected) \
do \ do \

9
test/Network/Socket.cpp Normal file
View File

@ -0,0 +1,9 @@
#include <SFML/Network/Socket.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::Socket>);
static_assert(!std::is_copy_constructible_v<sf::Socket>);
static_assert(!std::is_copy_assignable_v<sf::Socket>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Socket>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Socket>);

View File

@ -0,0 +1,10 @@
#include <SFML/Network/SocketSelector.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::SocketSelector>);
static_assert(std::is_copy_assignable_v<sf::SocketSelector>);
static_assert(std::is_move_constructible_v<sf::SocketSelector>);
static_assert(!std::is_nothrow_move_constructible_v<sf::SocketSelector>);
static_assert(std::is_move_assignable_v<sf::SocketSelector>);
static_assert(!std::is_nothrow_move_assignable_v<sf::SocketSelector>);

View File

@ -0,0 +1,8 @@
#include <SFML/Network/TcpListener.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::TcpListener>);
static_assert(!std::is_copy_assignable_v<sf::TcpListener>);
static_assert(!std::is_nothrow_move_constructible_v<sf::TcpListener>);
static_assert(!std::is_nothrow_move_assignable_v<sf::TcpListener>);

View File

@ -0,0 +1,8 @@
#include <SFML/Network/TcpSocket.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::TcpSocket>);
static_assert(!std::is_copy_assignable_v<sf::TcpSocket>);
static_assert(!std::is_nothrow_move_constructible_v<sf::TcpSocket>);
static_assert(!std::is_nothrow_move_assignable_v<sf::TcpSocket>);

View File

@ -0,0 +1,8 @@
#include <SFML/Network/UdpSocket.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::UdpSocket>);
static_assert(!std::is_copy_assignable_v<sf::UdpSocket>);
static_assert(!std::is_nothrow_move_constructible_v<sf::UdpSocket>);
static_assert(!std::is_nothrow_move_assignable_v<sf::UdpSocket>);

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Angle>);
static_assert(std::is_copy_assignable_v<sf::Angle>);
static_assert(std::is_nothrow_move_constructible_v<sf::Angle>);
static_assert(std::is_nothrow_move_assignable_v<sf::Angle>);
TEST_CASE("[System] sf::Angle") TEST_CASE("[System] sf::Angle")
{ {

View File

@ -5,6 +5,12 @@
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <thread> #include <thread>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Clock>);
static_assert(std::is_copy_assignable_v<sf::Clock>);
static_assert(std::is_nothrow_move_constructible_v<sf::Clock>);
static_assert(std::is_nothrow_move_assignable_v<sf::Clock>);
TEST_CASE("[System] sf::Clock") TEST_CASE("[System] sf::Clock")
{ {

8
test/System/String.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/System/String.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::String>);
static_assert(std::is_copy_assignable_v<sf::String>);
static_assert(std::is_nothrow_move_constructible_v<sf::String>);
static_assert(std::is_nothrow_move_assignable_v<sf::String>);

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <SystemUtil.hpp> #include <SystemUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::Time>);
static_assert(std::is_copy_assignable_v<sf::Time>);
static_assert(std::is_nothrow_move_constructible_v<sf::Time>);
static_assert(std::is_nothrow_move_assignable_v<sf::Time>);
using namespace std::chrono_literals; using namespace std::chrono_literals;

View File

@ -11,6 +11,10 @@ using namespace sf::Literals;
// Use sf::Vector2i for tests (except for float vector algebra). // Use sf::Vector2i for tests (except for float vector algebra).
// Test coverage is given, as there are no template specializations. // Test coverage is given, as there are no template specializations.
static_assert(std::is_copy_constructible_v<sf::Vector2i>);
static_assert(std::is_copy_assignable_v<sf::Vector2i>);
static_assert(std::is_nothrow_move_constructible_v<sf::Vector2i>);
static_assert(std::is_nothrow_move_assignable_v<sf::Vector2i>);
TEST_CASE("[System] sf::Vector2") TEST_CASE("[System] sf::Vector2")
{ {

View File

@ -8,6 +8,11 @@
// Use sf::Vector3i for tests (except for float vector algebra). // Use sf::Vector3i for tests (except for float vector algebra).
// Test coverage is given, as there are no template specializations. // Test coverage is given, as there are no template specializations.
static_assert(std::is_copy_constructible_v<sf::Vector3i>);
static_assert(std::is_copy_assignable_v<sf::Vector3i>);
static_assert(std::is_nothrow_move_constructible_v<sf::Vector3i>);
static_assert(std::is_nothrow_move_assignable_v<sf::Vector3i>);
TEST_CASE("[System] sf::Vector3") TEST_CASE("[System] sf::Vector3")
{ {
SUBCASE("Construction") SUBCASE("Construction")

8
test/Window/Context.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Window/Context.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Context>);
static_assert(!std::is_copy_assignable_v<sf::Context>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Context>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Context>);

View File

@ -2,6 +2,13 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::ContextSettings>);
static_assert(std::is_copy_assignable_v<sf::ContextSettings>);
static_assert(std::is_nothrow_move_constructible_v<sf::ContextSettings>);
static_assert(std::is_nothrow_move_assignable_v<sf::ContextSettings>);
TEST_CASE("[Window] sf::ContextSettings") TEST_CASE("[Window] sf::ContextSettings")
{ {
SUBCASE("Construction") SUBCASE("Construction")

8
test/Window/Cursor.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Window/Cursor.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Cursor>);
static_assert(!std::is_copy_assignable_v<sf::Cursor>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Cursor>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Cursor>);

View File

@ -0,0 +1,9 @@
#include <SFML/Window/GlResource.hpp>
#include <type_traits>
static_assert(!std::is_constructible_v<sf::GlResource>);
static_assert(!std::is_copy_constructible_v<sf::GlResource>);
static_assert(std::is_copy_assignable_v<sf::GlResource>);
static_assert(!std::is_nothrow_move_constructible_v<sf::GlResource>);
static_assert(std::is_nothrow_move_assignable_v<sf::GlResource>);

View File

@ -3,6 +3,12 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <WindowUtil.hpp> #include <WindowUtil.hpp>
#include <type_traits>
static_assert(std::is_copy_constructible_v<sf::VideoMode>);
static_assert(std::is_copy_assignable_v<sf::VideoMode>);
static_assert(std::is_nothrow_move_constructible_v<sf::VideoMode>);
static_assert(std::is_nothrow_move_assignable_v<sf::VideoMode>);
TEST_CASE("[Window] sf::VideoMode") TEST_CASE("[Window] sf::VideoMode")
{ {

8
test/Window/Window.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <SFML/Window/Window.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::Window>);
static_assert(!std::is_copy_assignable_v<sf::Window>);
static_assert(!std::is_nothrow_move_constructible_v<sf::Window>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Window>);

View File

@ -0,0 +1,8 @@
#include <SFML/Window/WindowBase.hpp>
#include <type_traits>
static_assert(!std::is_copy_constructible_v<sf::WindowBase>);
static_assert(!std::is_copy_assignable_v<sf::WindowBase>);
static_assert(!std::is_nothrow_move_constructible_v<sf::WindowBase>);
static_assert(!std::is_nothrow_move_assignable_v<sf::WindowBase>);