Added usubBorrow tests

This commit is contained in:
Christophe Riccio
2014-10-21 01:40:42 +02:00
parent fcfc56d5e3
commit 2179695e02
2 changed files with 53 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/integer.hpp>
#include <glm/gtc/vec1.hpp>
#include <iostream>
enum result
@@ -225,14 +226,58 @@ namespace usubBorrow
{
int Error(0);
glm::uint x = 16;
glm::uint y = 17;
glm::uint Borrow = 0;
glm::uint Result = glm::usubBorrow(x, y, Borrow);
{
glm::uint x = 16;
glm::uint y = 17;
glm::uint Borrow = 0;
glm::uint Result = glm::usubBorrow(x, y, Borrow);
Error += Borrow == 1 ? 0 : 1;
Error += Result == 1 ? 0 : 1;
}
{
glm::uvec1 x(16);
glm::uvec1 y(17);
glm::uvec1 Borrow(0);
glm::uvec1 Result(glm::usubBorrow(x, y, Borrow));
Error += glm::all(glm::equal(Borrow, glm::uvec1(1))) ? 0 : 1;
Error += glm::all(glm::equal(Result, glm::uvec1(1))) ? 0 : 1;
}
{
glm::uvec2 x(16);
glm::uvec2 y(17);
glm::uvec2 Borrow(0);
glm::uvec2 Result(glm::usubBorrow(x, y, Borrow));
Error += glm::all(glm::equal(Borrow, glm::uvec2(1))) ? 0 : 1;
Error += glm::all(glm::equal(Result, glm::uvec2(1))) ? 0 : 1;
}
{
glm::uvec3 x(16);
glm::uvec3 y(17);
glm::uvec3 Borrow(0);
glm::uvec3 Result(glm::usubBorrow(x, y, Borrow));
Error += glm::all(glm::equal(Borrow, glm::uvec3(1))) ? 0 : 1;
Error += glm::all(glm::equal(Result, glm::uvec3(1))) ? 0 : 1;
}
{
glm::uvec4 x(16);
glm::uvec4 y(17);
glm::uvec4 Borrow(0);
glm::uvec4 Result(glm::usubBorrow(x, y, Borrow));
Error += glm::all(glm::equal(Borrow, glm::uvec4(1))) ? 0 : 1;
Error += glm::all(glm::equal(Result, glm::uvec4(1))) ? 0 : 1;
}
return Error;
}
}//namespace usubBorrow
int main()
@@ -241,6 +286,7 @@ int main()
std::cout << "sizeof(glm::uint64): " << sizeof(glm::detail::uint64) << std::endl;
Error += ::usubBorrow::test();
Error += ::bitfieldExtract::test();
Error += ::bitfieldReverse::test();
Error += ::findMSB::test();