From c8910924253ee859a6ef61b750c5b3c03b0c4f5c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 15 Jan 2011 22:08:31 +0000 Subject: [PATCH] Added unit tests for vector relational --- glm/core/func_vector_relational.hpp | 51 ++++----- test/core/CMakeLists.txt | 2 + test/core/core_vector_relational.cpp | 148 +++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 25 deletions(-) create mode 100644 test/core/core_vector_relational.cpp diff --git a/glm/core/func_vector_relational.hpp b/glm/core/func_vector_relational.hpp index 6cecf195..30e5a601 100644 --- a/glm/core/func_vector_relational.hpp +++ b/glm/core/func_vector_relational.hpp @@ -33,11 +33,10 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint) && detail::is_vector >::_YES, - "'lessThan' only accept numbers"); + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'lessThan', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) @@ -54,11 +53,10 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint) && detail::is_vector >::_YES, - "'lessThanEqual' only accept numbers"); + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'lessThanEqual', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) @@ -75,11 +73,10 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint) && detail::is_vector >::_YES, - "'greaterThan' only accept numbers"); + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'greaterThan', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) @@ -96,11 +93,10 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint) && detail::is_vector >::_YES, - "'greaterThanEqual' only accept numbers"); + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'greaterThanEqual', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) @@ -117,7 +113,8 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, "'equal' only accept GLM vectors"); + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'equal', GLM vector types required"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) @@ -134,7 +131,8 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, "'notEqual' only accept GLM vectors"); + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'notEqual', GLM vector types required"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) @@ -147,7 +145,8 @@ namespace glm template