Fixed log from GTX_lob_base build error with tests #470, #471

This commit is contained in:
Christophe Riccio 2016-01-01 14:30:14 +01:00
parent a827b248ef
commit 1936921ec7
2 changed files with 51 additions and 6 deletions

View File

@ -53,15 +53,15 @@ namespace glm
/// @addtogroup gtx_log_base
/// @{
//! Logarithm for any base.
//! From GLM_GTX_log_base.
/// Logarithm for any base.
/// From GLM_GTX_log_base.
template <typename genType>
GLM_FUNC_DECL genType log(
genType x,
genType base);
genType const & x,
genType const & base);
//! Logarithm for any base.
//! From GLM_GTX_log_base.
/// Logarithm for any base.
/// From GLM_GTX_log_base.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sign(
vecType<T, P> const & x,

View File

@ -30,10 +30,55 @@
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/log_base.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/exponential.hpp>
namespace test_log
{
int run()
{
int Error = 0;
{
float A = glm::log(10.f, 2.0f);
float B = glm::log2(10.f);
Error += glm::epsilonEqual(A, B, 0.00001f) ? 0 : 1;
}
{
glm::vec1 A = glm::log(glm::vec1(10.f), glm::vec1(2.0f));
glm::vec1 B = glm::log2(glm::vec1(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec1(0.00001f))) ? 0 : 1;
}
{
glm::vec2 A = glm::log(glm::vec2(10.f), glm::vec2(2.0f));
glm::vec2 B = glm::log2(glm::vec2(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec2(0.00001f))) ? 0 : 1;
}
{
glm::vec3 A = glm::log(glm::vec3(10.f), glm::vec3(2.0f));
glm::vec3 B = glm::log2(glm::vec3(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec3(0.00001f))) ? 0 : 1;
}
{
glm::vec4 A = glm::log(glm::vec4(10.f), glm::vec4(2.0f));
glm::vec4 B = glm::log2(glm::vec4(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec4(0.00001f))) ? 0 : 1;
}
return Error;
}
}//namespace test_log
int main()
{
int Error(0);
Error += test_log::run();
return Error;
}