From c7812d44cfae477343e5d27eb28a3da20fadc487 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 16 Sep 2012 23:26:25 +0200 Subject: [PATCH] Added findLSB test --- test/core/core_func_integer.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index 9605ffaf..41ca7a77 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -198,10 +198,32 @@ namespace findMSB namespace findLSB { + template + struct type + { + genType Value; + genType Return; + }; + + type const DataI32[] = + { + {0x00000001, 0}, + {0x00000003, 0}, + {0x00000002, 1}, + {0x80000000, 31} + }; + int test() { int Error(0); + for(std::size_t i = 0; i < sizeof(DataI32) / sizeof(type); ++i) + { + int Result = glm::findLSB(DataI32[i].Value); + Error += DataI32[i].Return == Result ? 0 : 1; + assert(!Error); + } + return Error; } }//findLSB