Fixed increment and decrement operators tests

This commit is contained in:
Christophe Riccio 2013-05-10 01:44:13 +02:00
parent 4a93e0ab70
commit 28d8e7f251
5 changed files with 15 additions and 9 deletions

View File

@ -33,7 +33,7 @@ namespace glm
{ {
#define GLM_CXX11_USER_LITERALS #define GLM_CXX11_USER_LITERALS
#ifdef GLM_CXX11_USER_LITERALS #ifdef GLM_CXX11_USER_LITERALS
/*
GLM_FUNC_QUALIFIER detail::half operator "" _h(long double const s) GLM_FUNC_QUALIFIER detail::half operator "" _h(long double const s)
{ {
return detail::half(s); return detail::half(s);
@ -43,7 +43,7 @@ namespace glm
{ {
return static_cast<float>(s); return static_cast<float>(s);
} }
*/
#endif//GLM_CXX11_USER_LITERALS #endif//GLM_CXX11_USER_LITERALS
}//namespace glm }//namespace glm

View File

@ -40,5 +40,5 @@ int main()
{ {
//auto d = 90.0_deg; //auto d = 90.0_deg;
glm::vec3 v{0, 1, 2}; //glm::vec3 v{0, 1, 2};
} }

View File

@ -169,7 +169,8 @@ int test_vec2_operators()
{ {
glm::vec2 A(1.0f, 2.0f); glm::vec2 A(1.0f, 2.0f);
glm::vec2 B = A--; glm::vec2 B = A--;
Error += B == glm::vec2(0.0f, 1.0f) ? 0 : 1; Error += B == glm::vec2(1.0f, 2.0f) ? 0 : 1;
Error += A == glm::vec2(0.0f, 1.0f) ? 0 : 1;
} }
{ {
@ -181,7 +182,8 @@ int test_vec2_operators()
{ {
glm::vec2 A(1.0f, 2.0f); glm::vec2 A(1.0f, 2.0f);
glm::vec2 B = A++; glm::vec2 B = A++;
Error += B == glm::vec2(2.0f, 3.0f) ? 0 : 1; Error += B == glm::vec2(1.0f, 2.0f) ? 0 : 1;
Error += A == glm::vec2(2.0f, 3.0f) ? 0 : 1;
} }
return Error; return Error;

View File

@ -148,7 +148,8 @@ int test_vec3_operators()
{ {
glm::vec3 A(1.0f, 2.0f, 3.0f); glm::vec3 A(1.0f, 2.0f, 3.0f);
glm::vec3 B = A--; glm::vec3 B = A--;
Error += B == glm::vec3(0.0f, 1.0f, 2.0f) ? 0 : 1; Error += B == glm::vec3(1.0f, 2.0f, 3.0f) ? 0 : 1;
Error += A == glm::vec3(0.0f, 1.0f, 2.0f) ? 0 : 1;
} }
{ {
@ -160,7 +161,8 @@ int test_vec3_operators()
{ {
glm::vec3 A(1.0f, 2.0f, 3.0f); glm::vec3 A(1.0f, 2.0f, 3.0f);
glm::vec3 B = A++; glm::vec3 B = A++;
Error += B == glm::vec3(2.0f, 3.0f, 4.0f) ? 0 : 1; Error += B == glm::vec3(1.0f, 2.0f, 3.0f) ? 0 : 1;
Error += A == glm::vec3(2.0f, 3.0f, 4.0f) ? 0 : 1;
} }
return Error; return Error;

View File

@ -182,7 +182,8 @@ int test_vec4_operators()
{ {
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f); glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
glm::vec4 B = A--; glm::vec4 B = A--;
Error += B == glm::vec4(0.0f, 1.0f, 2.0f, 3.0f) ? 0 : 1; Error += B == glm::vec4(1.0f, 2.0f, 3.0f, 4.0f) ? 0 : 1;
Error += A == glm::vec4(0.0f, 1.0f, 2.0f, 3.0f) ? 0 : 1;
} }
{ {
@ -194,7 +195,8 @@ int test_vec4_operators()
{ {
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f); glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
glm::vec4 B = A++; glm::vec4 B = A++;
Error += B == glm::vec4(2.0f, 3.0f, 4.0f, 5.0f) ? 0 : 1; Error += B == glm::vec4(1.0f, 2.0f, 3.0f, 4.0f) ? 0 : 1;
Error += A == glm::vec4(2.0f, 3.0f, 4.0f, 5.0f) ? 0 : 1;
} }
return Error; return Error;