From f8a110964b39e1f03dab7f49f0dfbd4a6ead7a2d Mon Sep 17 00:00:00 2001 From: hashlag Date: Sat, 17 Oct 2026 21:47:25 +0300 Subject: [PATCH] Add move assignment operator for SeArray. --- Chaos/Service/SeArray.hpp | 2 +- ChaosTests/Service/SeArrayTests.cpp | 36 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Chaos/Service/SeArray.hpp b/Chaos/Service/SeArray.hpp index 604cc01..9001451 100644 --- a/Chaos/Service/SeArray.hpp +++ b/Chaos/Service/SeArray.hpp @@ -21,7 +21,7 @@ public: SeArray(SeArray && other) = delete; SeArray & operator=(const SeArray & other) = default; - SeArray & operator=(SeArray && other) = delete; + SeArray & operator=(SeArray && other) = default; ~SeArray() { diff --git a/ChaosTests/Service/SeArrayTests.cpp b/ChaosTests/Service/SeArrayTests.cpp index 816a87e..cf00e92 100644 --- a/ChaosTests/Service/SeArrayTests.cpp +++ b/ChaosTests/Service/SeArrayTests.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "Service/SeArray.hpp" @@ -290,3 +291,38 @@ TEST(SeArrayTests, CopyAssignTest) ASSERT_EQ(0, arr1[4]); } } + +TEST(SeArrayTests, MoveAssignTest) +{ + { + SeArray arr1; + + SeArray arr2; + arr2[0] = 0xaa; + arr2[1] = 0xbb; + + arr1 = std::move(arr2); + + ASSERT_EQ(0xaa, arr1[0]); + ASSERT_EQ(0xbb, arr1[1]); + } + + { + SeArray arr1; + arr1[0] = 0x33; + arr1[1] = 0x44; + arr1[2] = 0x55; + arr1[3] = 0x66; + arr1[4] = 0x77; + + SeArray arr2; + + arr1 = std::move(arr2); + + ASSERT_EQ(0, arr1[0]); + ASSERT_EQ(0, arr1[1]); + ASSERT_EQ(0, arr1[2]); + ASSERT_EQ(0, arr1[3]); + ASSERT_EQ(0, arr1[4]); + } +}