Add tests for SFML/Config.hpp
This commit is contained in:
parent
e691033954
commit
49fd5887c8
@ -24,6 +24,7 @@ set_target_warnings(sfml-test-main)
|
|||||||
SET(SYSTEM_SRC
|
SET(SYSTEM_SRC
|
||||||
System/Angle.cpp
|
System/Angle.cpp
|
||||||
System/Clock.cpp
|
System/Clock.cpp
|
||||||
|
System/Config.cpp
|
||||||
System/Err.cpp
|
System/Err.cpp
|
||||||
System/FileInputStream.cpp
|
System/FileInputStream.cpp
|
||||||
System/MemoryInputStream.cpp
|
System/MemoryInputStream.cpp
|
||||||
@ -32,6 +33,12 @@ SET(SYSTEM_SRC
|
|||||||
System/Vector3.cpp
|
System/Vector3.cpp
|
||||||
)
|
)
|
||||||
sfml_add_test(test-sfml-system "${SYSTEM_SRC}" SFML::System)
|
sfml_add_test(test-sfml-system "${SYSTEM_SRC}" SFML::System)
|
||||||
|
target_compile_definitions(test-sfml-system PRIVATE
|
||||||
|
EXPECTED_SFML_VERSION_MAJOR=${SFML_VERSION_MAJOR}
|
||||||
|
EXPECTED_SFML_VERSION_MINOR=${SFML_VERSION_MINOR}
|
||||||
|
EXPECTED_SFML_VERSION_PATCH=${SFML_VERSION_PATCH}
|
||||||
|
EXPECTED_SFML_VERSION_IS_RELEASE=$<IF:$<BOOL:${VERSION_IS_RELEASE}>,true,false>
|
||||||
|
)
|
||||||
|
|
||||||
SET(WINDOW_SRC
|
SET(WINDOW_SRC
|
||||||
Window/ContextSettings.cpp
|
Window/ContextSettings.cpp
|
||||||
|
29
test/System/Config.cpp
Normal file
29
test/System/Config.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <SFML/Config.hpp>
|
||||||
|
|
||||||
|
#include <doctest/doctest.h>
|
||||||
|
|
||||||
|
TEST_CASE("SFML/Config.hpp")
|
||||||
|
{
|
||||||
|
SUBCASE("Version macros")
|
||||||
|
{
|
||||||
|
CHECK(SFML_VERSION_MAJOR == EXPECTED_SFML_VERSION_MAJOR);
|
||||||
|
CHECK(SFML_VERSION_MINOR == EXPECTED_SFML_VERSION_MINOR);
|
||||||
|
CHECK(SFML_VERSION_PATCH == EXPECTED_SFML_VERSION_PATCH);
|
||||||
|
CHECK(SFML_VERSION_IS_RELEASE == EXPECTED_SFML_VERSION_IS_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("Fixed width types")
|
||||||
|
{
|
||||||
|
CHECK(sizeof(sf::Int8) == 1);
|
||||||
|
CHECK(sizeof(sf::Uint8) == 1);
|
||||||
|
|
||||||
|
CHECK(sizeof(sf::Int16) == 2);
|
||||||
|
CHECK(sizeof(sf::Uint16) == 2);
|
||||||
|
|
||||||
|
CHECK(sizeof(sf::Int32) == 4);
|
||||||
|
CHECK(sizeof(sf::Uint32) == 4);
|
||||||
|
|
||||||
|
CHECK(sizeof(sf::Int64) == 8);
|
||||||
|
CHECK(sizeof(sf::Uint64) == 8);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user