Added initial constexpr tests #783

This commit is contained in:
Groove 2018-07-09 23:54:10 +02:00
parent 13ef0f92bc
commit c06993191f
14 changed files with 138 additions and 48 deletions

View File

@ -146,15 +146,25 @@ int test_size()
return Error;
}
int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat2x2::length() == 2, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error(0);
int Error = 0;
Error += cast::test();
Error += test_ctr();
Error += test_operators();
Error += test_inverse();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -120,6 +120,15 @@ int test_size()
return Error;
}
int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat2x3::length() == 2, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -128,6 +137,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -108,7 +108,7 @@ namespace cast
}
}//namespace cast
int test_size()
static int test_size()
{
int Error = 0;
@ -122,6 +122,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat2x4::length() == 2, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -130,6 +139,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -110,7 +110,7 @@ namespace cast
}
}//namespace cast
int test_size()
static int test_size()
{
int Error = 0;
@ -124,6 +124,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat3x2::length() == 3, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -132,6 +141,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -169,7 +169,7 @@ namespace cast
}
}//namespace cast
int test_size()
static int test_size()
{
int Error = 0;
@ -183,6 +183,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat3x3::length() == 3, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -193,6 +202,7 @@ int main()
Error += test_operators();
Error += test_inverse();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -112,7 +112,7 @@ namespace cast
}
}//namespace cast
int test_size()
static int test_size()
{
int Error = 0;
@ -126,6 +126,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat3x4::length() == 3, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -134,6 +143,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -114,7 +114,7 @@ namespace cast
}
}//namespace cast
int test_size()
static int test_size()
{
int Error = 0;
@ -128,6 +128,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat4x2::length() == 4, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -136,6 +145,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -114,7 +114,7 @@ namespace cast
}
}//namespace cast
int test_size()
static int test_size()
{
int Error = 0;
@ -128,6 +128,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat4x3::length() == 4, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -136,6 +145,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();
return Error;
}

View File

@ -305,7 +305,7 @@ struct repro
glm::mat4* matrix;
};
int test_size()
static int test_size()
{
int Error = 0;
@ -319,6 +319,15 @@ int test_size()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::mat4::length() == 4, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -332,6 +341,7 @@ int main()
Error += test_operators();
Error += test_inverse();
Error += test_size();
Error += test_constexpr();
Error += perf_mul();

View File

@ -94,7 +94,7 @@ int test_vec1_ctor()
return Error;
}
int test_vec1_size()
static int test_vec1_size()
{
int Error = 0;
@ -110,7 +110,7 @@ int test_vec1_size()
return Error;
}
int test_vec1_operator_increment()
static int test_vec1_operator_increment()
{
int Error(0);

View File

@ -12,7 +12,7 @@ static glm::vec2 g1;
static glm::vec2 g2(1);
static glm::vec2 g3(1, 1);
int test_vec2_operators()
static int test_operators()
{
int Error = 0;
@ -197,7 +197,7 @@ int test_vec2_operators()
return Error;
}
int test_vec2_ctor()
static int test_ctor()
{
int Error = 0;
@ -299,7 +299,7 @@ int test_vec2_ctor()
return Error;
}
int test_vec2_size()
static int test_size()
{
int Error = 0;
@ -318,9 +318,9 @@ int test_vec2_size()
return Error;
}
int test_operator_increment()
static int test_operator_increment()
{
int Error(0);
int Error = 0;
glm::ivec2 v0(1);
glm::ivec2 v1(v0);
@ -345,7 +345,7 @@ int test_operator_increment()
return Error;
}
int test_vec2_constexpr()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec2::length() == 2, "GLM: Failed constexpr");
@ -359,11 +359,11 @@ int main()
{
int Error = 0;
Error += test_vec2_size();
Error += test_vec2_ctor();
Error += test_vec2_operators();
Error += test_size();
Error += test_ctor();
Error += test_operators();
Error += test_operator_increment();
Error += test_vec2_constexpr();
Error += test_constexpr();
return Error;
}

View File

@ -531,7 +531,7 @@ int test_vec3_swizzle_partial()
}
#endif//!GLM_HAS_ONLY_XYZW
int test_operator_increment()
static int test_operator_increment()
{
int Error(0);
@ -558,7 +558,7 @@ int test_operator_increment()
return Error;
}
int test_vec3_constexpr()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec3::length() == 3, "GLM: Failed constexpr");
@ -579,7 +579,7 @@ int main()
Error += test_vec3_swizzle3_2();
Error += test_vec3_swizzle3_3();
Error += test_operator_increment();
Error += test_vec3_constexpr();
Error += test_constexpr();
# if !GLM_HAS_ONLY_XYZW
Error += test_vec3_swizzle_partial();

View File

@ -344,7 +344,7 @@ static int test_bvec4_ctor()
return Error;
}
static int test_vec4_operators()
static int test_operators()
{
int Error = 0;
@ -480,7 +480,7 @@ static int test_vec4_operators()
return Error;
}
static int test_vec4_equal()
static int test_equal()
{
int Error = 0;
@ -501,7 +501,7 @@ static int test_vec4_equal()
return Error;
}
static int test_vec4_size()
static int test_size()
{
int Error = 0;
@ -521,7 +521,7 @@ static int test_vec4_size()
return Error;
}
static int test_vec4_swizzle_partial()
static int test_swizzle_partial()
{
int Error = 0;
@ -560,7 +560,7 @@ static int test_vec4_swizzle_partial()
static int test_operator_increment()
{
int Error(0);
int Error = 0;
glm::ivec4 v0(1);
glm::ivec4 v1(v0);
@ -593,9 +593,9 @@ struct AoS
glm::vec2 D;
};
static int test_vec4_perf_AoS(std::size_t Size)
static int test_perf_AoS(std::size_t Size)
{
int Error(0);
int Error = 0;
std::vector<AoS> In;
std::vector<AoS> Out;
@ -614,9 +614,9 @@ static int test_vec4_perf_AoS(std::size_t Size)
return Error;
}
static int test_vec4_perf_SoA(std::size_t Size)
static int test_perf_SoA(std::size_t Size)
{
int Error(0);
int Error = 0;
std::vector<glm::vec4> InA;
std::vector<glm::vec3> InB;
@ -680,7 +680,7 @@ namespace heap
}
}//namespace heap
static int test_vec4_simd()
static int test_simd()
{
int Error = 0;
@ -720,7 +720,7 @@ static int test_inheritance()
return Error;
}
int test_vec4_constexpr()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec4::length() == 4, "GLM: Failed constexpr");
@ -782,20 +782,20 @@ int main()
std::size_t const Size(1);
# endif//NDEBUG
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);
Error += test_perf_AoS(Size);
Error += test_perf_SoA(Size);
Error += test_vec4_ctor();
Error += test_bvec4_ctor();
Error += test_vec4_size();
Error += test_vec4_operators();
Error += test_vec4_equal();
Error += test_vec4_swizzle_partial();
Error += test_vec4_simd();
Error += test_size();
Error += test_operators();
Error += test_equal();
Error += test_swizzle_partial();
Error += test_simd();
Error += test_operator_increment();
Error += heap::test();
Error += test_inheritance();
Error += test_vec4_constexpr();
Error += test_constexpr();
return Error;
}

View File

@ -6,7 +6,7 @@
static glm::vec1 g1;
static glm::vec1 g2(1);
int test_vec1_operators()
static int test_vec1_operators()
{
int Error(0);
@ -34,7 +34,7 @@ int test_vec1_operators()
return Error;
}
int test_vec1_ctor()
static int test_vec1_ctor()
{
int Error = 0;
@ -63,7 +63,7 @@ int test_vec1_ctor()
return Error;
}
int test_vec1_size()
static int test_vec1_size()
{
int Error = 0;
@ -82,7 +82,7 @@ int test_vec1_size()
return Error;
}
int test_vec1_operator_increment()
static int test_vec1_operator_increment()
{
int Error(0);
@ -132,7 +132,7 @@ static int test_bvec1_ctor()
return Error;
}
int test_vec1_constexpr()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::vec1::length() == 1, "GLM: Failed constexpr");
@ -151,7 +151,7 @@ int main()
Error += test_bvec1_ctor();
Error += test_vec1_operators();
Error += test_vec1_operator_increment();
Error += test_vec1_constexpr();
Error += test_constexpr();
return Error;
}