Skip to content

Commit

Permalink
gne
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Jan 17, 2024
1 parent 3703860 commit 2e6f648
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 45 deletions.
23 changes: 12 additions & 11 deletions test/core/core_type_vec3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ static int test_vec3_ctor()
{
glm::vec3 a{ 0, 1, 2 };
std::vector<glm::vec3> v = {
{0, 1, 2},
a,
{4, 5, 6},
{8, 9, 0}};
}

{
glm::dvec3 a{ 0, 1, 2 };
std::vector<glm::dvec3> v = {
{0, 1, 2},
a,
{4, 5, 6},
{8, 9, 0}};
}
Expand All @@ -70,8 +70,9 @@ static int test_vec3_ctor()
Tests.push_back(glm::ivec3(1, 2, 3));
Tests.push_back(glm::ivec3(glm::ivec4(1, 2, 3, 4)));

for(std::size_t i = 0; i < Tests.size(); ++i)
for (std::size_t i = 0; i < Tests.size(); ++i) {
Error += Tests[i] == glm::ivec3(1, 2, 3) ? 0 : 1;
}
}

{
Expand Down Expand Up @@ -139,19 +140,19 @@ static int test_bvec3_ctor()
{
int Error = 0;

glm::bvec3 const A(true);
glm::bvec3 const B(true);
glm::bvec3 const C(false);
glm::bvec3 const D = A && B;
glm::bvec3 const E = A && C;
glm::bvec3 const F = A || C;
glm::bvec3 A(true);
glm::bvec3 B(true);
glm::bvec3 C(false);
glm::bvec3 D = A && B;
glm::bvec3 E = A && C;
glm::bvec3 F = A || C;

Error += D == glm::bvec3(true) ? 0 : 1;
Error += E == glm::bvec3(false) ? 0 : 1;
Error += F == glm::bvec3(true) ? 0 : 1;

bool const G = A == C;
bool const H = A != C;
bool G = A == C;
bool H = A != C;
Error += !G ? 0 : 1;
Error += H ? 0 : 1;

Expand Down
68 changes: 34 additions & 34 deletions test/core/core_type_vec4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ static int test_vec4_ctor()
{
glm::vec4 a{ 0, 1, 2, 3 };
std::vector<glm::vec4> v = {
{0, 1, 2, 3},
a,
{4, 5, 6, 7},
{8, 9, 0, 1}};
}

{
glm::dvec4 a{ 0, 1, 2, 3 };
std::vector<glm::dvec4> v = {
{0, 1, 2, 3},
a,
{4, 5, 6, 7},
{8, 9, 0, 1}};
}
#endif

{
glm::ivec4 const A(1);
glm::ivec4 const B(1, 1, 1, 1);
glm::ivec4 A(1);
glm::ivec4 B(1, 1, 1, 1);

Error += A == B ? 0 : 1;
}
Expand All @@ -108,59 +108,59 @@ static int test_vec4_ctor()
}

{
glm::vec1 const R(1.0f);
glm::vec1 const S(2.0f);
glm::vec1 const T(3.0f);
glm::vec1 const U(4.0f);
glm::vec4 const O(1.0f, 2.0f, 3.0f, 4.0f);
glm::vec1 R(1.0f);
glm::vec1 S(2.0f);
glm::vec1 T(3.0f);
glm::vec1 U(4.0f);
glm::vec4 O(1.0f, 2.0f, 3.0f, 4.0f);

glm::vec4 const A(R);
glm::vec4 const B(1.0f);
glm::vec4 A(R);
glm::vec4 B(1.0f);
Error += glm::all(glm::equal(A, B, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const C(R, S, T, U);
glm::vec4 C(R, S, T, U);
Error += glm::all(glm::equal(C, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const D(R, 2.0f, 3.0f, 4.0f);
glm::vec4 D(R, 2.0f, 3.0f, 4.0f);
Error += glm::all(glm::equal(D, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const E(1.0f, S, 3.0f, 4.0f);
glm::vec4 E(1.0f, S, 3.0f, 4.0f);
Error += glm::all(glm::equal(E, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const F(R, S, 3.0f, 4.0f);
glm::vec4 F(R, S, 3.0f, 4.0f);
Error += glm::all(glm::equal(F, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const G(1.0f, 2.0f, T, 4.0f);
glm::vec4 G(1.0f, 2.0f, T, 4.0f);
Error += glm::all(glm::equal(G, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const H(R, 2.0f, T, 4.0f);
glm::vec4 H(R, 2.0f, T, 4.0f);
Error += glm::all(glm::equal(H, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const I(1.0f, S, T, 4.0f);
glm::vec4 I(1.0f, S, T, 4.0f);
Error += glm::all(glm::equal(I, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const J(R, S, T, 4.0f);
glm::vec4 J(R, S, T, 4.0f);
Error += glm::all(glm::equal(J, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const K(R, 2.0f, 3.0f, U);
glm::vec4 K(R, 2.0f, 3.0f, U);
Error += glm::all(glm::equal(K, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const L(1.0f, S, 3.0f, U);
glm::vec4 L(1.0f, S, 3.0f, U);
Error += glm::all(glm::equal(L, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const M(R, S, 3.0f, U);
glm::vec4 M(R, S, 3.0f, U);
Error += glm::all(glm::equal(M, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const N(1.0f, 2.0f, T, U);
glm::vec4 N(1.0f, 2.0f, T, U);
Error += glm::all(glm::equal(N, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const P(R, 2.0f, T, U);
glm::vec4 P(R, 2.0f, T, U);
Error += glm::all(glm::equal(P, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const Q(1.0f, S, T, U);
glm::vec4 Q(1.0f, S, T, U);
Error += glm::all(glm::equal(Q, O, glm::epsilon<float>())) ? 0 : 1;

glm::vec4 const V(R, S, T, U);
glm::vec4 V(R, S, T, U);
Error += glm::all(glm::equal(V, O, glm::epsilon<float>())) ? 0 : 1;
}

Expand Down Expand Up @@ -294,19 +294,19 @@ static int test_bvec4_ctor()
{
int Error = 0;

glm::bvec4 const A(true);
glm::bvec4 const B(true);
glm::bvec4 const C(false);
glm::bvec4 const D = A && B;
glm::bvec4 const E = A && C;
glm::bvec4 const F = A || C;
glm::bvec4 A(true);
glm::bvec4 B(true);
glm::bvec4 C(false);
glm::bvec4 D = A && B;
glm::bvec4 E = A && C;
glm::bvec4 F = A || C;

Error += D == glm::bvec4(true) ? 0 : 1;
Error += E == glm::bvec4(false) ? 0 : 1;
Error += F == glm::bvec4(true) ? 0 : 1;

bool const G = A == C;
bool const H = A != C;
bool G = A == C;
bool H = A != C;
Error += !G ? 0 : 1;
Error += H ? 0 : 1;

Expand Down

0 comments on commit 2e6f648

Please sign in to comment.