Added GTC_integer, deprecated GTX_bit

This commit is contained in:
Christophe Riccio
2014-10-26 19:22:19 +01:00
parent eaa3b72b99
commit d3b368b65c
8 changed files with 192 additions and 209 deletions

View File

@@ -1,6 +1,7 @@
glmCreateTestGTC(gtc_bitfield)
glmCreateTestGTC(gtc_constants)
glmCreateTestGTC(gtc_epsilon)
glmCreateTestGTC(gtc_integer)
glmCreateTestGTC(gtc_matrix_access)
glmCreateTestGTC(gtc_matrix_integer)
glmCreateTestGTC(gtc_matrix_inverse)

View File

@@ -1,16 +1,15 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2010-09-16
// Created : 2014-10-25
// Updated : 2014-10-25
// Licence : This source is under MIT licence
// File : test/gtx/bit.cpp
// File : test/gtc/integer.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/bit.hpp>
#include <glm/gtc/integer.hpp>
#include <glm/gtc/type_precision.hpp>
namespace isPowerOfTwo
{
template <typename genType>
@@ -20,29 +19,61 @@ namespace isPowerOfTwo
bool Return;
};
type<int> const DataI32[] =
int test_int()
{
{0x00000001, true},
{0x00000002, true},
{0x00000004, true},
{0xffffffff, true},
{0x00000000, true},
{0x00000003, true}
};
type<int> const DataI32[] =
{
{0x00000001, true},
{0x00000002, true},
{0x00000004, true},
{0xffffffff, true},
{0x00000000, true},
{0x00000003, false}
};
int test()
{
int Error(0);
for(std::size_t i = 0, n = sizeof(DataI32) / sizeof(type<int>); i < n; ++i)
{
bool Result = glm::isPowerOfTwo(DataI32[i].Value);
Error += DataI32[i].Return == Result ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_uint()
{
type<glm::uint> const DataU32[] =
{
{0x00000001, true},
{0x00000002, true},
{0x00000004, true},
{0x80000000, true},
{0x00000000, true},
{0x00000003, false}
};
int Error(0);
for(std::size_t i = 0, n = sizeof(DataU32) / sizeof(type<glm::uint>); i < n; ++i)
{
bool Result = glm::isPowerOfTwo(DataU32[i].Value);
Error += DataU32[i].Return == Result ? 0 : 1;
}
return Error;
}
int test()
{
int Error(0);
Error += test_int();
Error += test_uint();
return Error;
}
}//isPowerOfTwo
int main()

View File

@@ -1,5 +1,4 @@
glmCreateTestGTC(gtx_associated_min_max)
glmCreateTestGTC(gtx_bit)
glmCreateTestGTC(gtx_closest_point)
glmCreateTestGTC(gtx_color_space_YCoCg)
glmCreateTestGTC(gtx_color_space)