From 8b4fbd21df72dde42060815f457ca3f896556b49 Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Fri, 30 Apr 2021 10:19:15 +0200 Subject: [PATCH] Add tests for MemoryID copy/move ctors/ops --- .../armem/test/ArMemMemoryIDTest.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/source/RobotAPI/libraries/armem/test/ArMemMemoryIDTest.cpp b/source/RobotAPI/libraries/armem/test/ArMemMemoryIDTest.cpp index 1f94d9adb..aad3359b0 100644 --- a/source/RobotAPI/libraries/armem/test/ArMemMemoryIDTest.cpp +++ b/source/RobotAPI/libraries/armem/test/ArMemMemoryIDTest.cpp @@ -137,3 +137,30 @@ BOOST_AUTO_TEST_CASE(test_MemoryID_from_to_string) } + +BOOST_AUTO_TEST_CASE(test_MemoryID_copy_move_ctors_ops) +{ + const armem::MemoryID id("A/B/C/123/1"), moved("////1"); // int is not moved + { + const armem::MemoryID out(id); + BOOST_CHECK_EQUAL(out, id); + } + { + armem::MemoryID out; + out = id; + BOOST_CHECK_EQUAL(out, id); + } + { + armem::MemoryID in = id; + const armem::MemoryID out(std::move(in)); + BOOST_CHECK_EQUAL(in, moved); + BOOST_CHECK_EQUAL(out, id); + } + { + armem::MemoryID in = id; + armem::MemoryID out; + out = std::move(in); + BOOST_CHECK_EQUAL(in, moved); + BOOST_CHECK_EQUAL(out, id); + } +} -- GitLab