Reduce dependencies, added scalar EXT extensions
This commit is contained in:
@@ -2,6 +2,10 @@ glmCreateTestGTC(ext_matrix_relational)
|
||||
glmCreateTestGTC(ext_quaternion_geometric)
|
||||
glmCreateTestGTC(ext_quaternion_relational)
|
||||
glmCreateTestGTC(ext_quaternion_type)
|
||||
glmCreateTestGTC(ext_scalar_constants)
|
||||
glmCreateTestGTC(ext_scalar_float_sized)
|
||||
glmCreateTestGTC(ext_scalar_int_sized)
|
||||
glmCreateTestGTC(ext_scalar_uint_sized)
|
||||
glmCreateTestGTC(ext_scalar_relational)
|
||||
glmCreateTestGTC(ext_vec1)
|
||||
glmCreateTestGTC(ext_vector_vec1)
|
||||
|
||||
36
test/ext/ext_scalar_constants.cpp
Normal file
36
test/ext/ext_scalar_constants.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <glm/ext/scalar_constants.hpp>
|
||||
|
||||
template <typename valType>
|
||||
static int test_epsilon()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
valType const Test = glm::epsilon<valType>();
|
||||
Error += Test > static_cast<valType>(0) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
static int test_pi()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
valType const Test = glm::pi<valType>();
|
||||
Error += Test > static_cast<valType>(3.14) ? 0 : 1;
|
||||
Error += Test < static_cast<valType>(3.15) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_epsilon<float>();
|
||||
Error += test_epsilon<double>();
|
||||
Error += test_pi<float>();
|
||||
Error += test_pi<double>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
37
test/ext/ext_scalar_float_sized.cpp
Normal file
37
test/ext/ext_scalar_float_sized.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <glm/ext/scalar_float_sized.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
|
||||
|
||||
#ifndef GLM_FORCE_SINGLE_ONLY
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
|
||||
#endif//GLM_FORCE_SINGLE_ONLY
|
||||
|
||||
static int test_float_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::float32) == sizeof(float) ? 0 : 1;
|
||||
Error += sizeof(glm::float64) == sizeof(double) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_float_precision()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(float) <= sizeof(double) ? 0 : 1;
|
||||
Error += sizeof(glm::float32) < sizeof(glm::float64) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_float_size();
|
||||
Error += test_float_precision();
|
||||
|
||||
return Error;
|
||||
}
|
||||
42
test/ext/ext_scalar_int_sized.cpp
Normal file
42
test/ext/ext_scalar_int_sized.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <glm/ext/scalar_int_sized.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == sizeof(short), "signed short size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == sizeof(int), "signed int size isn't 4 bytes on this platform");
|
||||
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::int8) == 1 ? 0 : 1;
|
||||
Error += sizeof(glm::int16) == 2 ? 0 : 1;
|
||||
Error += sizeof(glm::int32) == 4 ? 0 : 1;
|
||||
Error += sizeof(glm::int64) == 8 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_comp()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::int8) < sizeof(glm::int16) ? 0 : 1;
|
||||
Error += sizeof(glm::int16) < sizeof(glm::int32) ? 0 : 1;
|
||||
Error += sizeof(glm::int32) < sizeof(glm::int64) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_size();
|
||||
Error += test_comp();
|
||||
|
||||
return Error;
|
||||
}
|
||||
42
test/ext/ext_scalar_uint_sized.cpp
Normal file
42
test/ext/ext_scalar_uint_sized.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <glm/ext/scalar_uint_sized.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == sizeof(unsigned short), "unsigned short size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == sizeof(unsigned int), "unsigned int size isn't 4 bytes on this platform");
|
||||
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::uint8) == 1 ? 0 : 1;
|
||||
Error += sizeof(glm::uint16) == 2 ? 0 : 1;
|
||||
Error += sizeof(glm::uint32) == 4 ? 0 : 1;
|
||||
Error += sizeof(glm::uint64) == 8 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_comp()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::uint8) < sizeof(glm::uint16) ? 0 : 1;
|
||||
Error += sizeof(glm::uint16) < sizeof(glm::uint32) ? 0 : 1;
|
||||
Error += sizeof(glm::uint32) < sizeof(glm::uint64) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_size();
|
||||
Error += test_comp();
|
||||
|
||||
return Error;
|
||||
}
|
||||
Reference in New Issue
Block a user