Added more initializer lists tests

This commit is contained in:
Christophe Riccio 2013-10-01 01:31:57 +02:00
parent 9b1f079856
commit 2d5724e23a
3 changed files with 100 additions and 2 deletions

View file

@ -7,8 +7,10 @@
// File : test/core/type_mat2x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/core/type_mat2x2.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/core/func_vector_relational.hpp>
#include <glm/core/type_mat2x2.hpp>
#include <vector>
int test_operators()
{
@ -53,10 +55,53 @@ int test_inverse()
return Error;
}
int test_ctr()
{
int Error(0);
#if(GLM_HAS_INITIALIZER_LISTS)
glm::mat2x2 m0(
glm::vec2(0, 1),
glm::vec2(2, 3));
glm::mat2x2 m1{0, 1, 2, 3};
glm::mat2x2 m2{
{0, 1},
{2, 3}};
for(int i = 0; i < m0.length(); ++i)
Error += glm::all(glm::equal(m0[i], m2[i])) ? 0 : 1;
for(int i = 0; i < m1.length(); ++i)
Error += glm::all(glm::equal(m1[i], m2[i])) ? 0 : 1;
std::vector<glm::mat2x2> v1{
{0, 1, 2, 3},
{0, 1, 2, 3}
};
std::vector<glm::mat2x2> v2{
{
{ 0, 1},
{ 4, 5}
},
{
{ 0, 1},
{ 4, 5}
}
};
#endif//GLM_HAS_INITIALIZER_LISTS
return Error;
}
int main()
{
int Error(0);
Error += test_ctr();
Error += test_operators();
Error += test_inverse();

View file

@ -7,7 +7,9 @@
// File : test/core/type_mat4x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/core/func_vector_relational.hpp>
#include <glm/core/type_mat4x2.hpp>
#include <vector>
static int test_operators()
{
@ -28,10 +30,61 @@ static int test_operators()
return (S && !R) ? 0 : 1;
}
int test_ctr()
{
int Error(0);
#if(GLM_HAS_INITIALIZER_LISTS)
glm::mat4x2 m0(
glm::vec2(0, 1),
glm::vec2(2, 3),
glm::vec2(4, 5),
glm::vec2(6, 7));
glm::mat4x2 m1{0, 1, 2, 3, 4, 5, 6, 7};
glm::mat4x2 m2{
{0, 1},
{2, 3},
{4, 5},
{6, 7}};
for(int i = 0; i < m0.length(); ++i)
Error += glm::all(glm::equal(m0[i], m2[i])) ? 0 : 1;
for(int i = 0; i < m1.length(); ++i)
Error += glm::all(glm::equal(m1[i], m2[i])) ? 0 : 1;
std::vector<glm::mat4x2> v1{
{0, 1, 2, 3, 4, 5, 6, 7},
{0, 1, 2, 3, 4, 5, 6, 7}
};
std::vector<glm::mat4x2> v2{
{
{ 0, 1},
{ 4, 5},
{ 8, 9},
{ 12, 13}
},
{
{ 0, 1},
{ 4, 5},
{ 8, 9},
{ 12, 13}
}
};
#endif//GLM_HAS_INITIALIZER_LISTS
return Error;
}
int main()
{
int Error = 0;
Error += test_ctr();
Error += test_operators();
return Error;

View file

@ -368,7 +368,7 @@ int main()
int Error(0);
std::size_t const Size(100000000);
std::size_t const Size(1000000);
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);