From cd476f6290d93313cb99cfd4efe65b75fd1b43be Mon Sep 17 00:00:00 2001 From: Mateusz Jakub Fila Date: Thu, 26 Sep 2024 15:30:25 +0200 Subject: [PATCH] test elements of moved container of interfaces --- tests/unittests/interface_types.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/unittests/interface_types.cpp b/tests/unittests/interface_types.cpp index 723d4920d..59079a382 100644 --- a/tests/unittests/interface_types.cpp +++ b/tests/unittests/interface_types.cpp @@ -1,5 +1,7 @@ #include "catch2/catch_test_macros.hpp" +#include "datamodel/ExampleHit.h" +#include "datamodel/MutableExampleMC.h" #include "datamodel/ExampleHitCollection.h" #include "datamodel/MutableExampleCluster.h" #include "datamodel/TypeWithEnergy.h" @@ -70,9 +72,15 @@ TEST_CASE("InterfaceTypes STL usage", "[interface-types][basics]") { REQUIRE(counterMap[hit] == 2); REQUIRE(counterMap[wrapper] == 2); + auto mc = MutableExampleMC{}; + mc.energy() = 3.14f; + // check container of interfaces move constructor and direct initialization - auto interfaces = std::vector{}; - [[maybe_unused]] auto interfaces2 = std::vector{std::move(interfaces)}; + auto interfaces = std::vector{empty, hit, mc}; + auto interfaces2 = std::vector{std::move(interfaces)}; + REQUIRE_FALSE(interfaces2.at(0).isAvailable()); + REQUIRE(interfaces2.at(1).isA()); + REQUIRE(interfaces2.at(2).energy() == 3.14f); } TEST_CASE("InterfaceType from immutable", "[interface-types][basics]") {