Added more constexpr tests #783

This commit is contained in:
Groove
2018-07-10 00:06:28 +02:00
parent d3a2542c77
commit f95abf2c27
4 changed files with 18 additions and 12 deletions

View File

@@ -350,6 +350,8 @@ static int test_constexpr()
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec2::length() == 2, "GLM: Failed constexpr");
static_assert(glm::vec2(1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec2(1.0f, -1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec2(1.0f, -1.0f).y < 0.0f, "GLM: Failed constexpr");
#endif
return 0;

View File

@@ -563,6 +563,8 @@ static int test_constexpr()
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec3::length() == 3, "GLM: Failed constexpr");
static_assert(glm::vec3(1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec3(1.0f, -1.0f, -1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec3(1.0f, -1.0f, -1.0f).y < 0.0f, "GLM: Failed constexpr");
#endif
return 0;

View File

@@ -105,17 +105,6 @@ static int test_vec4_ctor()
}
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE && !(GLM_COMPILER & GLM_COMPILER_VC) // Visual Studio bug?
{
constexpr glm::ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
# endif
{
glm::vec4 A(1);
glm::vec4 B(1, 1, 1, 1);
@@ -725,6 +714,8 @@ static int test_constexpr()
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec4::length() == 4, "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f, -1.0f, -1.0f, -1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f, -1.0f, -1.0f, -1.0f).y < 0.0f, "GLM: Failed constexpr");
#endif
return 0;