Enable /WX, warning as error on Visual Studio

This commit is contained in:
Christophe Riccio
2017-08-17 19:51:03 +02:00
parent 23db2cd8b9
commit e9f210c85f
15 changed files with 192 additions and 178 deletions

View File

@@ -106,13 +106,22 @@ namespace fmod_
int test_isdenormal()
{
int Error(0);
int Error = 0;
bool A = glm::isdenormal(1.0f);
Error += !A ? 0 : 1;
glm::bvec1 B = glm::isdenormal(glm::vec1(1.0f));
Error += !glm::any(B) ? 0 : 1;
glm::bvec2 C = glm::isdenormal(glm::vec2(1.0f));
Error += !glm::any(C) ? 0 : 1;
glm::bvec3 D = glm::isdenormal(glm::vec3(1.0f));
Error += !glm::any(D) ? 0 : 1;
glm::bvec4 E = glm::isdenormal(glm::vec4(1.0f));
Error += !glm::any(E) ? 0 : 1;
return Error;
}

View File

@@ -8,7 +8,6 @@ int test_axisAngle()
{
int Error = 0;
float p = 0.171654f;
glm::mat4 m1(-0.9946f, 0.0f, -0.104531f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.104531f, 0.0f, -0.9946f, 0.0f,

View File

@@ -43,21 +43,24 @@ int test_quat_shortMix()
int test_orientation()
{
int Error(0);
int Error = 0;
{
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
float p = glm::roll(q);
Error += glm::epsilonEqual(p, glm::pi<float>() * 0.5f, 0.0001f) ? 0 : 1;
}
{
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
float p = glm::pitch(q);
Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1;
}
{
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
float p = glm::yaw(q);
Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1;
}
return Error;
@@ -113,6 +116,7 @@ int main()
Error += test_log();
Error += test_rotation();
Error += test_orientation();
Error += test_quat_fastMix();
Error += test_quat_shortMix();
Error += test_quat_lookAt();

View File

@@ -6,40 +6,68 @@
#include <glm/gtx/range.hpp>
int testVec()
int test_vec()
{
int Error(0);
glm::vec3 v(1, 2, 3);
int Error = 0;
int count = 0;
for(float x : v){ count++; }
Error += count == 3 ? 0 : 1;
{
glm::ivec3 const v(1, 2, 3);
int count = 0;
glm::ivec3 Result(0);
for(int x : v)
{
Result[count] = x;
count++;
}
Error += count == 3 ? 0 : 1;
Error += v == Result ? 0 : 1;
}
{
glm::ivec3 v(1, 2, 3);
for(int& x : v)
x = 0;
Error += glm::all(glm::equal(v, glm::ivec3(0))) ? 0 : 1;
}
for(float& x : v){ x = 0; }
Error += glm::all(glm::equal(v, glm::vec3(0, 0, 0))) ? 0 : 1;
return Error;
}
int testMat()
int test_mat()
{
int Error(0);
glm::mat4x3 m(1);
int Error = 0;
int count = 0;
for(float x : m){ count++; }
Error += count == 12 ? 0 : 1;
{
glm::mat4x3 m(1.0f);
int count = 0;
float Sum = 0.0f;
for(float x : m)
{
count++;
Sum += x;
}
Error += count == 12 ? 0 : 1;
Error += glm::epsilonEqual(Sum, 3.0f, 0.001f) ? 0 : 1;
}
{
glm::mat4x3 m(1.0f);
for (float& x : m) { x = 0; }
glm::vec4 v(1, 1, 1, 1);
Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1;
}
for(float& x : m){ x = 0; }
glm::vec4 v(1, 1, 1, 1);
Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1;
return Error;
}
int main()
{
int Error(0);
Error += testVec();
Error += testMat();
int Error = 0;
Error += test_vec();
Error += test_mat();
return Error;
}