Platformer in OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.1 KiB

5 years ago
  1. #include <glm/ext/vector_bool1.hpp>
  2. #include <glm/ext/vector_bool1_precision.hpp>
  3. template <typename genType>
  4. static int test_operators()
  5. {
  6. int Error = 0;
  7. genType const A(true);
  8. genType const B(true);
  9. {
  10. bool const R = A != B;
  11. bool const S = A == B;
  12. Error += (S && !R) ? 0 : 1;
  13. }
  14. return Error;
  15. }
  16. template <typename genType>
  17. static int test_ctor()
  18. {
  19. int Error = 0;
  20. glm::bvec1 const A = genType(true);
  21. glm::bvec1 const E(genType(true));
  22. Error += A == E ? 0 : 1;
  23. glm::bvec1 const F(E);
  24. Error += A == F ? 0 : 1;
  25. return Error;
  26. }
  27. template <typename genType>
  28. static int test_size()
  29. {
  30. int Error = 0;
  31. Error += sizeof(glm::bvec1) == sizeof(genType) ? 0 : 1;
  32. Error += genType().length() == 1 ? 0 : 1;
  33. Error += genType::length() == 1 ? 0 : 1;
  34. return Error;
  35. }
  36. template <typename genType>
  37. static int test_relational()
  38. {
  39. int Error = 0;
  40. genType const A(true);
  41. genType const B(true);
  42. genType const C(false);
  43. Error += A == B ? 0 : 1;
  44. Error += (A && B) == A ? 0 : 1;
  45. Error += (A || C) == A ? 0 : 1;
  46. return Error;
  47. }
  48. template <typename genType>
  49. static int test_constexpr()
  50. {
  51. # if GLM_HAS_CONSTEXPR
  52. static_assert(genType::length() == 1, "GLM: Failed constexpr");
  53. # endif
  54. return 0;
  55. }
  56. int main()
  57. {
  58. int Error = 0;
  59. Error += test_operators<glm::bvec1>();
  60. Error += test_operators<glm::lowp_bvec1>();
  61. Error += test_operators<glm::mediump_bvec1>();
  62. Error += test_operators<glm::highp_bvec1>();
  63. Error += test_ctor<glm::bvec1>();
  64. Error += test_ctor<glm::lowp_bvec1>();
  65. Error += test_ctor<glm::mediump_bvec1>();
  66. Error += test_ctor<glm::highp_bvec1>();
  67. Error += test_size<glm::bvec1>();
  68. Error += test_size<glm::lowp_bvec1>();
  69. Error += test_size<glm::mediump_bvec1>();
  70. Error += test_size<glm::highp_bvec1>();
  71. Error += test_relational<glm::bvec1>();
  72. Error += test_relational<glm::lowp_bvec1>();
  73. Error += test_relational<glm::mediump_bvec1>();
  74. Error += test_relational<glm::highp_bvec1>();
  75. Error += test_constexpr<glm::bvec1>();
  76. Error += test_constexpr<glm::lowp_bvec1>();
  77. Error += test_constexpr<glm::mediump_bvec1>();
  78. Error += test_constexpr<glm::highp_bvec1>();
  79. return Error;
  80. }