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 13ef0f9 commit c069931
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 48 deletions.
12 changes: 11 additions & 1 deletion test/core/core_type_mat2x2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
10 changes: 10 additions & 0 deletions test/core/core_type_mat2x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -128,6 +137,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();

return Error;
}
12 changes: 11 additions & 1 deletion test/core/core_type_mat2x4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace cast
}
}//namespace cast

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -130,6 +139,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();

return Error;
}
Expand Down
12 changes: 11 additions & 1 deletion test/core/core_type_mat3x2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace cast
}
}//namespace cast

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -132,6 +141,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();

return Error;
}
Expand Down
12 changes: 11 additions & 1 deletion test/core/core_type_mat3x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace cast
}
}//namespace cast

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -193,6 +202,7 @@ int main()
Error += test_operators();
Error += test_inverse();
Error += test_size();
Error += test_constexpr();

return Error;
}
Expand Down
12 changes: 11 additions & 1 deletion test/core/core_type_mat3x4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace cast
}
}//namespace cast

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -134,6 +143,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();

return Error;
}
Expand Down
12 changes: 11 additions & 1 deletion test/core/core_type_mat4x2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace cast
}
}//namespace cast

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -136,6 +145,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();

return Error;
}
Expand Down
12 changes: 11 additions & 1 deletion test/core/core_type_mat4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace cast
}
}//namespace cast

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -136,6 +145,7 @@ int main()
Error += test_ctr();
Error += test_operators();
Error += test_size();
Error += test_constexpr();

return Error;
}
Expand Down
12 changes: 11 additions & 1 deletion test/core/core_type_mat4x4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ struct repro
glm::mat4* matrix;
};

int test_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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;
Expand All @@ -332,6 +341,7 @@ int main()
Error += test_operators();
Error += test_inverse();
Error += test_size();
Error += test_constexpr();

Error += perf_mul();

Expand Down
4 changes: 2 additions & 2 deletions test/core/core_type_vec1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int test_vec1_ctor()
return Error;
}

int test_vec1_size()
static int test_vec1_size()
{
int Error = 0;

Expand All @@ -110,7 +110,7 @@ int test_vec1_size()
return Error;
}

int test_vec1_operator_increment()
static int test_vec1_operator_increment()
{
int Error(0);

Expand Down
20 changes: 10 additions & 10 deletions test/core/core_type_vec2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -197,7 +197,7 @@ int test_vec2_operators()
return Error;
}

int test_vec2_ctor()
static int test_ctor()
{
int Error = 0;

Expand Down Expand Up @@ -299,7 +299,7 @@ int test_vec2_ctor()
return Error;
}

int test_vec2_size()
static int test_size()
{
int Error = 0;

Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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;
}
6 changes: 3 additions & 3 deletions test/core/core_type_vec3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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");
Expand All @@ -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();
Expand Down
Loading

0 comments on commit c069931

Please sign in to comment.