From d6e24170b4eba86cf96d95174cc7c32ccd02bd38 Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 21 Dec 2023 18:06:43 +0100 Subject: [PATCH] Nan is not supported with C++98 --- test/ext/ext_vector_common.cpp | 73 ++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/test/ext/ext_vector_common.cpp b/test/ext/ext_vector_common.cpp index 211003fca..045f29202 100644 --- a/test/ext/ext_vector_common.cpp +++ b/test/ext/ext_vector_common.cpp @@ -68,6 +68,38 @@ static int test_min() return Error; } +template +static int test_max() +{ + typedef typename vecType::value_type T; + + int Error = 0; + + vecType const N(static_cast(0)); + vecType const B(static_cast(1)); + Error += glm::all(glm::equal(glm::max(N, B), B, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(B, N), B, glm::epsilon())) ? 0 : 1; + + vecType const C(static_cast(2)); + Error += glm::all(glm::equal(glm::max(N, B, C), C, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(B, N, C), C, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(C, N, B), C, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(C, B, N), C, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(B, C, N), C, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(N, C, B), C, glm::epsilon())) ? 0 : 1; + + vecType const D(static_cast(3)); + Error += glm::all(glm::equal(glm::max(D, N, B, C), D, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(B, D, N, C), D, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(C, N, D, B), D, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(C, B, D, N), D, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(B, C, N, D), D, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(glm::max(N, C, B, D), D, glm::epsilon())) ? 0 : 1; + + return Error; +} + +#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) template static int test_min_nan() { @@ -100,37 +132,6 @@ static int test_min_nan() return Error; } -template -static int test_max() -{ - typedef typename vecType::value_type T; - - int Error = 0; - - vecType const N(static_cast(0)); - vecType const B(static_cast(1)); - Error += glm::all(glm::equal(glm::max(N, B), B, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(B, N), B, glm::epsilon())) ? 0 : 1; - - vecType const C(static_cast(2)); - Error += glm::all(glm::equal(glm::max(N, B, C), C, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(B, N, C), C, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(C, N, B), C, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(C, B, N), C, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(B, C, N), C, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(N, C, B), C, glm::epsilon())) ? 0 : 1; - - vecType const D(static_cast(3)); - Error += glm::all(glm::equal(glm::max(D, N, B, C), D, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(B, D, N, C), D, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(C, N, D, B), D, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(C, B, D, N), D, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(B, C, N, D), D, glm::epsilon())) ? 0 : 1; - Error += glm::all(glm::equal(glm::max(N, C, B, D), D, glm::epsilon())) ? 0 : 1; - - return Error; -} - template 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(); Error += test_min(); - Error += test_min_nan(); - Error += test_min_nan(); - Error += test_max(); Error += test_max(); + +#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) + Error += test_min_nan(); + Error += test_min_nan(); Error += test_max_nan(); Error += test_max_nan(); Error += test_fmin(); Error += test_fmin(); - Error += test_fmax(); Error += test_fmax(); +#endif// Error += test_clamp(); Error += test_repeat();