Completed GTC_vec1

This commit is contained in:
Christophe Riccio
2014-10-15 02:53:46 +02:00
parent 6d1610ce0d
commit 8a1bf4410b
10 changed files with 1092 additions and 697 deletions

View File

@@ -8,9 +8,11 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp>
#include <vector>
int test_operators()
int test_vec1_operators()
{
int Error(0);
@@ -38,7 +40,69 @@ int test_operators()
return Error;
}
int test_operator_increment()
int test_vec1_ctor()
{
int Error = 0;
/*
#if GLM_HAS_INITIALIZER_LISTS
{
glm::vec1 a{ 0 };
std::vector<glm::vec1> v = {
{0.f},
{4.f},
{8.f}};
}
{
glm::dvec2 a{ 0 };
std::vector<glm::dvec1> v = {
{0.0},
{4.0},
{8.0}};
}
#endif
*/
#if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy;
glm::vec2 C(A.xy);
glm::vec2 D(A.xy());
Error += glm::all(glm::equal(A, B)) ? 0 : 1;
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
}
#endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{
glm::vec2 A = glm::vec2(2.0f);
glm::vec2 B = glm::vec2(2.0f, 3.0f);
glm::vec2 C = glm::vec2(2.0f, 3.0);
//glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says?
glm::vec2 E(glm::dvec2(2.0));
glm::vec2 F(glm::ivec2(2));
}
return Error;
}
int test_vec1_size()
{
int Error = 0;
Error += sizeof(glm::vec1) == sizeof(glm::mediump_vec1) ? 0 : 1;
Error += 8 == sizeof(glm::mediump_vec1) ? 0 : 1;
Error += sizeof(glm::dvec1) == sizeof(glm::highp_dvec1) ? 0 : 1;
Error += 16 == sizeof(glm::highp_dvec1) ? 0 : 1;
Error += glm::vec1().length() == 2 ? 0 : 1;
Error += glm::dvec1().length() == 2 ? 0 : 1;
return Error;
}
int test_vec1_operator_increment()
{
int Error(0);
@@ -69,8 +133,13 @@ int main()
{
int Error = 0;
Error += test_operators();
Error += test_operator_increment();
glm::vec1 v;
assert(v.length() == 1);
Error += test_vec1_size();
Error += test_vec1_ctor();
Error += test_vec1_operators();
Error += test_vec1_operator_increment();
return Error;
}

View File

@@ -201,7 +201,7 @@ int test_vec2_ctor()
{
int Error = 0;
#if(GLM_HAS_INITIALIZER_LISTS)
#if GLM_HAS_INITIALIZER_LISTS
{
glm::vec2 a{ 0, 1 };
std::vector<glm::vec2> v = {
@@ -219,7 +219,7 @@ int test_vec2_ctor()
}
#endif
#if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
#if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy;
@@ -230,7 +230,7 @@ int test_vec2_ctor()
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
}
#endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
#endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{
glm::vec2 A = glm::vec2(2.0f);
@@ -239,7 +239,6 @@ int test_vec2_ctor()
//glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says?
glm::vec2 E(glm::dvec2(2.0));
glm::vec2 F(glm::ivec2(2));
}
return Error;