From 0a0e1ecc2ac8ecfc33e21348f8c6e72c9aa207a0 Mon Sep 17 00:00:00 2001
From: armar-user <armar6@kit>
Date: Tue, 4 May 2021 12:43:12 +0200
Subject: [PATCH] Test aron type in copy/move ctors/ops

---
 .../libraries/armem/test/ArMemMemoryTest.cpp  | 37 ++++++++++++++++++-
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp
index 3c2564689..7588230d8 100644
--- a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp
+++ b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp
@@ -171,7 +171,7 @@ namespace ArMemMemoryTest
 
         MemoryContainerCtorOpTestFixture()
         {
-            cont.container() = std::vector<int>{ -1, 2, -3 };
+            cont.container() = std::vector<int> { -1, 2, -3 };
             BOOST_CHECK_EQUAL(cont.id(), id);
             BOOST_CHECK_EQUAL(cont.size(), 3);
         }
@@ -496,6 +496,12 @@ struct CopyMoveCtorsOpsTest : public CopyMoveCtorsOpsTestBase
 
         BOOST_CHECK_EQUAL(in.id(), id);
         BOOST_CHECK_EQUAL(in.size(), 1);
+
+        if constexpr(std::is_base_of_v <armarx::armem::base::detail::AronTyped, T>)
+        {
+            in.aronType() = std::make_shared<aron::typenavigator::ObjectNavigator>();
+            BOOST_CHECK(in.aronType());
+        }
     }
 
     void testCopyCtor() override
@@ -506,6 +512,13 @@ struct CopyMoveCtorsOpsTest : public CopyMoveCtorsOpsTestBase
         BOOST_CHECK_EQUAL(out.id(), id);
         BOOST_CHECK_EQUAL(out.size(), 1);
 
+        if constexpr(std::is_base_of_v <armarx::armem::base::detail::AronTyped, T>)
+        {
+            BOOST_CHECK(in.aronType());
+            BOOST_CHECK(out.aronType());
+            BOOST_CHECK_EQUAL(in.aronType(), out.aronType());
+        }
+
         CustomChecks<T>::checkEqual(out, in);
     }
     void testCopyOp() override
@@ -517,6 +530,13 @@ struct CopyMoveCtorsOpsTest : public CopyMoveCtorsOpsTestBase
         BOOST_CHECK_EQUAL(out.id(), id);
         BOOST_CHECK_EQUAL(out.size(), 1);
 
+        if constexpr(std::is_base_of_v <armarx::armem::base::detail::AronTyped, T>)
+        {
+            BOOST_CHECK(in.aronType());
+            BOOST_CHECK(out.aronType());
+            BOOST_CHECK_EQUAL(in.aronType(), out.aronType());
+        }
+
         CustomChecks<T>::checkEqual(out, in);
     }
     void testMoveCtor() override
@@ -528,6 +548,12 @@ struct CopyMoveCtorsOpsTest : public CopyMoveCtorsOpsTestBase
         BOOST_CHECK_EQUAL(out.id(), id);
         BOOST_CHECK_EQUAL(out.size(), 1);
 
+        if constexpr(std::is_base_of_v <armarx::armem::base::detail::AronTyped, T>)
+        {
+            BOOST_CHECK(out.aronType());
+            BOOST_CHECK_EQUAL(in.aronType(), nullptr);
+        }
+
         CustomChecks<T>::checkMoved(in);
     }
     void testMoveOp() override
@@ -540,6 +566,12 @@ struct CopyMoveCtorsOpsTest : public CopyMoveCtorsOpsTestBase
         BOOST_CHECK_EQUAL(out.id(), id);
         BOOST_CHECK_EQUAL(out.size(), 1);
 
+        if constexpr(std::is_base_of_v <armarx::armem::base::detail::AronTyped, T>)
+        {
+            BOOST_CHECK(out.aronType());
+            BOOST_CHECK_EQUAL(in.aronType(), nullptr);
+        }
+
         CustomChecks<T>::checkMoved(in);
     }
 };
@@ -781,7 +813,7 @@ struct CopyTest
         T t;
         T t2 = t.copy();
 
-        if constexpr (!std::is_base_of_v<armem::base::EntityInstanceBase<T>, T>)
+        if constexpr(!std::is_base_of_v<armem::base::EntityInstanceBase<T>, T>)
         {
             t2 = t.copyEmpty();
         }
@@ -816,3 +848,4 @@ BOOST_AUTO_TEST_CASE(test_copy)
         CopyTest<armem::d_ltm::Memory>().test();
     }
 }
+
-- 
GitLab