glm/test/gtx/gtx_hash.cpp
Mark Sheppard 3cb568cd37 Fix Clang 15 test build errors
Fixes for compiler errors when building the tests using Clang 15,
including:

    * Use explicit cast to silence Wimplicit-int-float-conversion
      warning for conversion of spin count in implementation of
      glm::slerp.
    * Use GLM_FORCE_MESSAGES instead of removed GLM_MESSAGES for
      messages in glm/gtx/hash.hpp, avoiding Wundef warning.
    * Encode en dash in URL for Gram-Schmit Process wikipedia page and
      replace similar en dashes in comments with regular dashes, to
      avoid Winvalid-utf8 warnings in glm/gtx/matrix_factorisation.inl.
    * Replace degree sign symbol with text "degrees" to avoid
      Winvalid-utf8 warnings in test/gtc/gtc_quaternion.cpp.
    * When using Clang, build tests with -Wno-float-equal to silence
      Wfloat-equal warning in implementation of glm::vec<L,T,Q>::equal.
    * For performance tests in test/gtx/gtx_fast_trigonometry.cpp, add
      statement explicitly casting result to void, to silence
      Wunused-but-set-variable warnings.
    * Add newline at end of test/gtx/gtx_hash.cpp to silence
      Wnewline-eof warning.
    * Rename namespace _1aga to agarose in test/gtx/gtx_pca.cpp to
      avoid Wreserved-identifier warning.
2023-03-31 17:39:53 +01:00

57 lines
1.7 KiB
C++

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/hash.hpp>
#include <unordered_map>
int test_compile()
{
int Error = 0;
// Vector types
std::unordered_map<glm::vec1, int> map_vec1;
Error += ++map_vec1[glm::vec1(0.0f)];
std::unordered_map<glm::vec2, int> map_vec2;
Error += ++map_vec2[glm::vec2(0.0f)];
std::unordered_map<glm::vec3, int> map_vec3;
Error += ++map_vec3[glm::vec3(0.0f)];
std::unordered_map<glm::vec4, int> map_vec4;
Error += ++map_vec4[glm::vec4(0.0f)];
// Quaternion types
std::unordered_map<glm::quat, int> map_quat;
Error += ++map_quat[glm::quat(0.0f, glm::vec3(0.0f))];
std::unordered_map<glm::dualquat, int> map_dualquat;
Error += ++map_dualquat[glm::dualquat(glm::vec3(0.0f))];
// Matrix types
std::unordered_map<glm::mat2x2, int> map_mat2x2;
Error += ++map_mat2x2[glm::mat2x2(0.0f)];
std::unordered_map<glm::mat2x3, int> map_mat2x3;
Error += ++map_mat2x3[glm::mat2x3(0.0f)];
std::unordered_map<glm::mat2x4, int> map_mat2x4;
Error += ++map_mat2x4[glm::mat2x4(0.0f)];
std::unordered_map<glm::mat3x2, int> map_mat3x2;
Error += ++map_mat3x2[glm::mat3x2(0.0f)];
std::unordered_map<glm::mat3x3, int> map_mat3x3;
Error += ++map_mat3x3[glm::mat3x3(0.0f)];
std::unordered_map<glm::mat3x4, int> map_mat3x4;
Error += ++map_mat3x4[glm::mat3x4(0.0f)];
std::unordered_map<glm::mat4x2, int> map_mat4x2;
Error += ++map_mat4x2[glm::mat4x2(0.0f)];
std::unordered_map<glm::mat4x3, int> map_mat4x3;
Error += ++map_mat4x3[glm::mat4x3(0.0f)];
std::unordered_map<glm::mat4x4, int> map_mat4x4;
Error += ++map_mat4x4[glm::mat4x4(0.0f)];
return Error > 0 ? 0 : 1;
}
int main()
{
int Error = 0;
Error += test_compile();
return Error;
}