Merge branch '0.9.3' of github.com:Groovounet/glm into 0.9.3

This commit is contained in:
Christophe Riccio
2012-05-08 20:58:01 +01:00
8 changed files with 105 additions and 136 deletions

View File

@@ -352,6 +352,62 @@ int test_roundEven()
return Error;
}
int test_isnan()
{
int Error = 0;
float Zero_f = 0.0;
double Zero_d = 0.0;
{
Error += true == glm::isnan(0.0/Zero_d) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::dvec2(0.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::dvec3(0.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::dvec4(0.0f/Zero_f))) ? 0 : 1;
}
{
Error += true == glm::isnan(0.0f/Zero_f) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::vec2(0.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::vec3(0.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::vec4(0.0f/Zero_f))) ? 0 : 1;
}
return Error;
}
int test_isinf()
{
int Error = 0;
float Zero_f = 0.0;
double Zero_d = 0.0;
{
Error += true == glm::isinf( 1.0/Zero_d) ? 0 : 1;
Error += true == glm::isinf(-1.0/Zero_d) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::dvec2( 1.0/Zero_d))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::dvec2(-1.0/Zero_d))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::dvec3( 1.0/Zero_d))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::dvec3(-1.0/Zero_d))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::dvec4( 1.0/Zero_d))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::dvec4(-1.0/Zero_d))) ? 0 : 1;
}
{
Error += true == glm::isinf( 1.0f/Zero_f) ? 0 : 1;
Error += true == glm::isinf(-1.0f/Zero_f) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::vec2( 1.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::vec2(-1.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::vec3( 1.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::vec3(-1.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::vec4( 1.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isinf(glm::vec4(-1.0f/Zero_f))) ? 0 : 1;
}
return Error;
}
int main()
{
int Error(0);
@@ -362,6 +418,8 @@ int main()
Error += test_mix();
Error += test_round();
Error += test_roundEven();
Error += test_isnan();
Error += test_isinf();
return Error;
}

View File

@@ -7,11 +7,21 @@
// File : test/core/core_func_swizzle.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_ONLY_XYZW
//#define GLM_FORCE_PURE
#define GLM_MESSAGES
#define GLM_SWIZZLE
#define GLM_FORCE_CXX98
#ifndef GLM_FORCE_ONLY_XYZW
# define GLM_FORCE_ONLY_XYZW
#endif
//#ifndef GLM_FORCE_PURE
//# define GLM_FORCE_PURE
//#endif
#ifndef GLM_MESSAGES
# define GLM_MESSAGES
#endif
#ifndef GLM_SWIZZLE
# define GLM_SWIZZLE
#endif
#ifndef GLM_FORCE_CXX98
# define GLM_FORCE_CXX98
#endif
#include <glm/glm.hpp>
int test_vec2_swizzle()

View File

@@ -53,8 +53,8 @@ int test_nlz()
{
int Error = 0;
for(std::size_t i = 1; i < 33; ++i)
Error += glm::nlz(i) == 31u - glm::findMSB(i) ? 0 : 1;
for(glm::uint i = 1; i < glm::uint(33); ++i)
Error += glm::nlz(i) == glm::uint(31u) - glm::findMSB(i) ? 0 : 1;
//printf("%d, %d\n", glm::nlz(i), 31u - glm::findMSB(i));
return Error;