Skip to content

Commit

Permalink
Added initial constexpr tests #783
Browse files Browse the repository at this point in the history
  • Loading branch information
Groove committed Jul 9, 2018
1 parent 398e66a commit f889ac0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
3 changes: 0 additions & 3 deletions test/core/core_type_vec1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ int test_vec1_size()
Error += glm::vec1::length() == 1 ? 0 : 1;
Error += glm::dvec1::length() == 1 ? 0 : 1;

GLM_CONSTEXPR_CXX11 std::size_t Length = glm::vec1::length();
Error += Length == 1 ? 0 : 1;

return Error;
}

Expand Down
11 changes: 11 additions & 0 deletions test/core/core_type_vec2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,16 @@ int test_operator_increment()
return Error;
}

int test_vec2_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");
#endif

return 0;
}

int main()
{
int Error = 0;
Expand All @@ -353,6 +363,7 @@ int main()
Error += test_vec2_ctor();
Error += test_vec2_operators();
Error += test_operator_increment();
Error += test_vec2_constexpr();

return Error;
}
11 changes: 11 additions & 0 deletions test/core/core_type_vec3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,16 @@ int test_operator_increment()
return Error;
}

int test_vec3_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");
#endif

return 0;
}

int main()
{
int Error = 0;
Expand All @@ -569,6 +579,7 @@ int main()
Error += test_vec3_swizzle3_2();
Error += test_vec3_swizzle3_3();
Error += test_operator_increment();
Error += test_vec3_constexpr();

# if !GLM_HAS_ONLY_XYZW
Error += test_vec3_swizzle_partial();
Expand Down
14 changes: 11 additions & 3 deletions test/core/core_type_vec4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,6 @@ static int test_vec4_size()
Error += glm::vec4::length() == 4 ? 0 : 1;
Error += glm::dvec4::length() == 4 ? 0 : 1;

GLM_CONSTEXPR_CXX11 std::size_t Length = glm::vec4::length();
Error += Length == 4 ? 0 : 1;

return Error;
}

Expand Down Expand Up @@ -723,6 +720,16 @@ static int test_inheritance()
return Error;
}

int test_vec4_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");
#endif

return 0;
}

int main()
{
int Error = 0;
Expand Down Expand Up @@ -788,6 +795,7 @@ int main()
Error += test_operator_increment();
Error += heap::test();
Error += test_inheritance();
Error += test_vec4_constexpr();

return Error;
}
Expand Down
11 changes: 11 additions & 0 deletions test/ext/ext_vec1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ static int test_bvec1_ctor()
return Error;
}

int test_vec1_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec1::length() == 1, "GLM: Failed constexpr");
static_assert(glm::vec1(1.0f).x > 0.0f, "GLM: Failed constexpr");
#endif

return 0;
}

int main()
{
int Error = 0;
Expand All @@ -141,6 +151,7 @@ int main()
Error += test_bvec1_ctor();
Error += test_vec1_operators();
Error += test_vec1_operator_increment();
Error += test_vec1_constexpr();

return Error;
}

0 comments on commit f889ac0

Please sign in to comment.