From c03490363f390278303f075940932315fd6151a9 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 14 Nov 2011 12:18:24 +0000 Subject: [PATCH] Added modf test --- test/core/core_func_common.cpp | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index c34838b4..e599d96b 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -8,6 +8,41 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include +#include + +int test_modf() +{ + int Error(0); + + { + float X(1.5f); + float I(0.0f); + float A = glm::modf(X, I); + + Error += I == 1.0f ? 0 : 1; + Error += A == 0.5f ? 0 : 1; + } + + { + glm::vec4 X(1.1f, 1.2f, 1.5f, 1.7f); + glm::vec4 I(0.0f); + glm::vec4 A = glm::modf(X, I); + + Error += I == glm::vec4(1.0f) ? 0 : 1; + Error += glm::all(glm::equalEpsilon(A, glm::vec4(0.1f, 0.2f, 0.5f, 0.7f), 0.00001f)) ? 0 : 1; + } + + { + double X(1.5); + double I(0.0); + double A = glm::modf(X, I); + + Error += I == 1.0 ? 0 : 1; + Error += A == 0.5 ? 0 : 1; + } + + return Error; +} int test_floatBitsToInt() { @@ -247,6 +282,7 @@ int main() { int Error = 0; + Error += test_modf(); Error += test_floatBitsToInt(); Error += test_floatBitsToUint(); Error += test_mix();