Fixed constexpr relational function and added tests

This commit is contained in:
Christophe Riccio
2018-08-07 23:52:57 +02:00
parent 13ca6771ca
commit c1be8bf008
8 changed files with 197 additions and 277 deletions

View File

@@ -7,12 +7,30 @@
#include <glm/ext/vector_relational.hpp>
#include <glm/ext/vector_int1.hpp>
#include <glm/ext/vector_bool1.hpp>
#include <glm/ext/vector_bool4.hpp>
#include <glm/ext/vector_float1.hpp>
#include <glm/vector_relational.hpp>
static int test_vec1()
{
int Error = 0;
{
constexpr glm::bvec1 B(true);
constexpr bool A = glm::all(B);
static_assert(A, "GLM: Failed constexpr");
constexpr glm::bvec1 D(true);
constexpr bool C = glm::any(D);
static_assert(C, "GLM: Failed constexpr");
}
{
constexpr glm::bvec2 C(true);
constexpr glm::bvec2 B(true);
static_assert(glm::any(glm::equal(C, B)), "GLM: Failed constexpr");
}
{
constexpr glm::ivec1 O(glm::ivec1(1));
static_assert(glm::ivec1(1) == O, "GLM: Failed constexpr");
@@ -154,6 +172,22 @@ static int test_vec2()
{
int Error = 0;
{
constexpr glm::bvec2 B(true);
constexpr bool A = glm::all(B);
static_assert(A, "GLM: Failed constexpr");
constexpr glm::bvec2 D(true, false);
constexpr bool C = glm::any(D);
static_assert(C, "GLM: Failed constexpr");
}
{
constexpr glm::bvec2 C(true);
constexpr glm::bvec2 B(true, false);
static_assert(glm::any(glm::equal(C, B)), "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 O(glm::ivec1(1));
static_assert(glm::ivec2(1) == O, "GLM: Failed constexpr");
@@ -311,6 +345,22 @@ static int test_vec3()
{
int Error = 0;
{
constexpr glm::bvec3 B(true);
constexpr bool A = glm::all(B);
static_assert(A, "GLM: Failed constexpr");
constexpr glm::bvec3 D(true, false, true);
constexpr bool C = glm::any(D);
static_assert(C, "GLM: Failed constexpr");
}
{
constexpr glm::bvec3 C(true);
constexpr glm::bvec3 B(true, false, true);
static_assert(glm::any(glm::equal(C, B)), "GLM: Failed constexpr");
}
{
constexpr glm::ivec3 O(glm::ivec1(1));
static_assert(glm::ivec3(1) == O, "GLM: Failed constexpr");
@@ -487,6 +537,22 @@ static int test_vec3()
static int test_vec4()
{
int Error = 0;
{
constexpr glm::bvec4 B(true);
constexpr bool A = glm::all(B);
static_assert(A, "GLM: Failed constexpr");
constexpr glm::bvec4 D(true, false, true, false);
constexpr bool C = glm::any(D);
static_assert(C, "GLM: Failed constexpr");
}
{
constexpr glm::bvec4 C(true);
constexpr glm::bvec4 B(true, false, true, false);
static_assert(glm::any(glm::equal(C, B)), "GLM: Failed constexpr");
}
{
constexpr glm::ivec4 O(glm::ivec4(1));