Added EXT_vector_relational: extend equal and notEqual to take an epsilon argument

This commit is contained in:
Christophe Riccio
2017-08-20 21:38:33 +02:00
parent 68a829e7ed
commit de28722e36
11 changed files with 197 additions and 4 deletions

View File

@@ -1 +1,2 @@
glmCreateTestGTC(ext_vec1)
glmCreateTestGTC(ext_vector_relational)

View File

@@ -1,4 +1,4 @@
#include <glm/gtc/vec1.hpp>
#include <glm/ext/vec1.hpp>
int main()
{

View File

@@ -0,0 +1,42 @@
#include <glm/ext/vector_relational.hpp>
#include <glm/vec2.hpp>
int test_equal()
{
int Error = 0;
Error += glm::equal(1.01f, 1.02f, 0.1f) ? 0 : 1;
Error += glm::all(glm::equal(glm::vec2(1.01f), glm::vec2(1.02f), 0.1f)) ? 0 : 1;
Error += glm::all(glm::equal(glm::vec2(1.01f), glm::vec2(1.02f), glm::vec2(0.1f))) ? 0 : 1;
Error += !glm::equal(1.01f, 1.02f, 0.001f) ? 0 : 1;
Error += !glm::any(glm::equal(glm::vec2(1.01f), glm::vec2(1.02f), 0.001f)) ? 0 : 1;
Error += !glm::any(glm::equal(glm::vec2(1.01f), glm::vec2(1.02f), glm::vec2(0.001f))) ? 0 : 1;
return Error;
}
int test_notEqual()
{
int Error = 0;
Error += glm::notEqual(1.01f, 1.02f, 0.001f) ? 0 : 1;
Error += glm::all(glm::notEqual(glm::vec2(1.01f), glm::vec2(1.02f), 0.001f)) ? 0 : 1;
Error += glm::all(glm::notEqual(glm::vec2(1.01f), glm::vec2(1.02f), glm::vec2(0.001f))) ? 0 : 1;
Error += !glm::notEqual(1.01f, 1.02f, 0.1f) ? 0 : 1;
Error += !glm::any(glm::notEqual(glm::vec2(1.01f), glm::vec2(1.02f), 0.1f)) ? 0 : 1;
Error += !glm::any(glm::notEqual(glm::vec2(1.01f), glm::vec2(1.02f), glm::vec2(0.1f))) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_equal();
Error += test_notEqual();
return Error;
}