Nan is not supported with C++98

This commit is contained in:
Christophe 2023-12-21 18:06:43 +01:00 committed by Christophe
parent 0ceaba1da9
commit d6e24170b4

View File

@ -68,6 +68,38 @@ static int test_min()
return Error;
}
template <typename vecType>
static int test_max()
{
typedef typename vecType::value_type T;
int Error = 0;
vecType const N(static_cast<T>(0));
vecType const B(static_cast<T>(1));
Error += glm::all(glm::equal(glm::max(N, B), B, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, N), B, glm::epsilon<T>())) ? 0 : 1;
vecType const C(static_cast<T>(2));
Error += glm::all(glm::equal(glm::max(N, B, C), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, N, C), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, N, B), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, B, N), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, C, N), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(N, C, B), C, glm::epsilon<T>())) ? 0 : 1;
vecType const D(static_cast<T>(3));
Error += glm::all(glm::equal(glm::max(D, N, B, C), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, D, N, C), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, N, D, B), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, B, D, N), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, C, N, D), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(N, C, B, D), D, glm::epsilon<T>())) ? 0 : 1;
return Error;
}
#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC))
template <typename vecType>
static int test_min_nan()
{
@ -100,37 +132,6 @@ static int test_min_nan()
return Error;
}
template <typename vecType>
static int test_max()
{
typedef typename vecType::value_type T;
int Error = 0;
vecType const N(static_cast<T>(0));
vecType const B(static_cast<T>(1));
Error += glm::all(glm::equal(glm::max(N, B), B, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, N), B, glm::epsilon<T>())) ? 0 : 1;
vecType const C(static_cast<T>(2));
Error += glm::all(glm::equal(glm::max(N, B, C), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, N, C), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, N, B), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, B, N), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, C, N), C, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(N, C, B), C, glm::epsilon<T>())) ? 0 : 1;
vecType const D(static_cast<T>(3));
Error += glm::all(glm::equal(glm::max(D, N, B, C), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, D, N, C), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, N, D, B), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(C, B, D, N), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(B, C, N, D), D, glm::epsilon<T>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::max(N, C, B, D), D, glm::epsilon<T>())) ? 0 : 1;
return Error;
}
template <typename vecType>
static int test_max_nan()
{
@ -226,6 +227,7 @@ static int test_fmax()
return Error;
}
#endif//
static int test_clamp()
{
@ -339,19 +341,20 @@ int main()
Error += test_min<glm::vec3>();
Error += test_min<glm::vec2>();
Error += test_min_nan<glm::vec3>();
Error += test_min_nan<glm::vec2>();
Error += test_max<glm::vec3>();
Error += test_max<glm::vec2>();
#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC))
Error += test_min_nan<glm::vec3>();
Error += test_min_nan<glm::vec2>();
Error += test_max_nan<glm::vec3>();
Error += test_max_nan<glm::vec2>();
Error += test_fmin<glm::vec3>();
Error += test_fmin<glm::vec2>();
Error += test_fmax<glm::vec3>();
Error += test_fmax<glm::vec2>();
#endif//
Error += test_clamp();
Error += test_repeat();