Added float unit tests

This commit is contained in:
Christophe Riccio 2011-05-06 10:10:11 +01:00
parent 22a2cd5332
commit ee56c3a449
2 changed files with 23 additions and 3 deletions

View File

@ -46,7 +46,7 @@ namespace glm
//! There is no guarantee on the actual precision.
//! From GLSL 1.30.8 specification
//! \ingroup core_precision
typedef mediump_float_t mediump_float;
typedef mediump_float_t mediump_float;
//! High precision floating-point numbers.
//! There is no guarantee on the actual precision.
//! From GLSL 1.30.8 specification
@ -58,7 +58,7 @@ namespace glm
#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef precision::mediump_float float_t;
#elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef precision::highp_float float_t;
typedef precision::highp_float float_t;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef precision::mediump_float float_t;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))

View File

@ -9,9 +9,29 @@
#include <glm/glm.hpp>
int test_float_size()
{
return
sizeof(glm::float_t) != sizeof(glm::lowp_float) &&
sizeof(glm::float_t) != sizeof(glm::mediump_float) &&
sizeof(glm::float_t) != sizeof(glm::highp_float);
}
int test_float_precision()
{
return (
sizeof(glm::lowp_float) <= sizeof(glm::mediump_float) &&
sizeof(glm::mediump_float) <= sizeof(glm::highp_float)) ? 0 : 1;
}
int main()
{
return -1;
int Error = 0;
Error += test_float_size();
Error += test_float_precision();
return Error;
}