From 64f9e3564d6f37b45f96d96b6a34ea6eb7250eeb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 13 Sep 2011 15:27:16 +0100 Subject: [PATCH] Added packHalf2x16 tests --- test/core/core_func_packing.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/core/core_func_packing.cpp b/test/core/core_func_packing.cpp index ce9378ee..2741bf95 100644 --- a/test/core/core_func_packing.cpp +++ b/test/core/core_func_packing.cpp @@ -8,11 +8,26 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include +#include +#include int test_packHalf2x16() { int Error = 0; + std::vector A; + A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 2.0f))); + A.push_back(glm::hvec2(glm::half(-1.0f), glm::half(-2.0f))); + A.push_back(glm::hvec2(glm::half(-1.1f), glm::half( 1.1f))); + + for(std::size_t i = 0; i < A.size(); ++i) + { + glm::vec2 B(A[i]); + glm::uint C = glm::packHalf2x16(B); + glm::vec2 D = glm::unpackHalf2x16(C); + Error += B == D ? 0 : 1; + } + return Error; }