diff --git a/edm4hep.yaml b/edm4hep.yaml index 0fbcf9e1..a2afa90d 100644 --- a/edm4hep.yaml +++ b/edm4hep.yaml @@ -80,27 +80,6 @@ components: return *( &x + i ) ; }\n " - - edm4hep::Vector2i: - Members: - - int32_t a - - int32_t b - ExtraCode: - includes: "#include " - declaration: " - constexpr Vector2i() : a(0),b(0) {}\n - constexpr Vector2i(int32_t aa, int32_t bb) : a(aa),b(bb) {}\n - constexpr Vector2i( const int32_t* v) : a(v[0]), b(v[1]) {}\n - constexpr bool operator==(const Vector2i& v) const { return (a==v.a&&b==v.b) ; }\n - constexpr bool operator!=(const Vector2i& v) const { return !(*this == v) ; }\n - constexpr int operator[](unsigned i) const {\n - static_assert(\n - offsetof(Vector2i,a)+sizeof(Vector2i::a) == offsetof(Vector2i,b),\n - \"operator[] requires no padding\");\n - return *( &a + i ) ; }\n - " - - edm4hep::Vector2f: Members: - float a diff --git a/test/utils/test_vector_utils.cpp b/test/utils/test_vector_utils.cpp index c01975c1..89ce7aa9 100644 --- a/test/utils/test_vector_utils.cpp +++ b/test/utils/test_vector_utils.cpp @@ -5,16 +5,14 @@ #include "edm4hep/utils/vector_utils.h" #include "edm4hep/Vector2f.h" -#include "edm4hep/Vector2i.h" #include "edm4hep/Vector3d.h" #include "edm4hep/Vector3f.h" #include "edm4hep/Vector4f.h" #include #include -using Vector2And3Types = std::tuple; -using AllVectorTypes = - std::tuple; +using Vector2And3Types = std::tuple; +using AllVectorTypes = std::tuple; template constexpr V create(); @@ -39,11 +37,6 @@ constexpr edm4hep::Vector2f create() { return edm4hep::Vector2f{1.0f, 2.0f}; } -template <> -constexpr edm4hep::Vector2i create() { - return edm4hep::Vector2i{1, 2}; -} - TEMPLATE_LIST_TEST_CASE("Vector uniform getters", "[vector_utils]", AllVectorTypes) { using namespace edm4hep; @@ -52,7 +45,7 @@ TEMPLATE_LIST_TEST_CASE("Vector uniform getters", "[vector_utils]", AllVectorTyp STATIC_REQUIRE(utils::vector_x(vector) == utils::ValueType(1.0)); STATIC_REQUIRE(utils::vector_y(vector) == utils::ValueType(2.0)); // 2D vectors fill z component with 0 - if constexpr (std::is_same_v || std::is_same_v) { + if constexpr (std::is_same_v) { STATIC_REQUIRE(utils::vector_z(vector) == utils::ValueType(0.0)); } else if constexpr (std::is_same_v) { STATIC_REQUIRE(utils::vector_t(vector) == utils::ValueType(4.0)); @@ -63,7 +56,6 @@ TEMPLATE_LIST_TEST_CASE("Vector uniform getters", "[vector_utils]", AllVectorTyp TEST_CASE("Vector ValueType", "[vector_utils]") { using namespace edm4hep; - STATIC_REQUIRE(std::is_same_v>); STATIC_REQUIRE(std::is_same_v>); STATIC_REQUIRE(std::is_same_v>); STATIC_REQUIRE(std::is_same_v>); @@ -86,7 +78,7 @@ TEMPLATE_LIST_TEST_CASE("Vector operators", "[vector_utils]", AllVectorTypes) { STATIC_REQUIRE(sumV - vector1 == vector2); // Vector product (depends again on whether it is 2D or 3D) - if constexpr (std::is_same_v || std::is_same_v) { + if constexpr (std::is_same_v) { STATIC_REQUIRE(vector1 * vector2 == utils::ValueType(5)); } else if constexpr (std::is_same_v || std::is_same_v) { STATIC_REQUIRE(vector1 * vector2 == utils::ValueType(14)); @@ -100,16 +92,13 @@ TEMPLATE_LIST_TEST_CASE("Vector utility functionality", "[vector_utils]", Vector using namespace edm4hep; - // Can only normalize vectors with floating point numbers - if constexpr (!std::is_same_v) { - const auto normV = utils::normalizeVector(vector); - REQUIRE(utils::magnitude(normV) == Catch::Approx(1)); - REQUIRE(utils::projection(normV, vector) == Catch::Approx(1)); - } + const auto normV = utils::normalizeVector(vector); + REQUIRE(utils::magnitude(normV) == Catch::Approx(1)); + REQUIRE(utils::projection(normV, vector) == Catch::Approx(1)); // Small differences in expectations between 2D and 3D vectors for everything // that involves the z component - if constexpr (std::is_same_v || std::is_same_v) { + if constexpr (std::is_same_v) { REQUIRE(utils::magnitude(vector) == Catch::Approx(std::sqrt(5))); const auto otherVec = TestType(3, 4);