Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-04-07 10:34:07 +0300
committerJacques Lucke <jacques@blender.org>2022-04-07 10:34:07 +0300
commit120a17a45a6d6c7f5520c8bfa32a0938f29a46be (patch)
tree22c2c63a975af9fd66cd1aa10205541075d27259 /source/blender/blenlib/tests
parente2f4c4db8d6cbe4694c24d599e16ee3889871bdd (diff)
BLI: add CPPType utility to copy elements to a shorter array
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r--source/blender/blenlib/tests/BLI_cpp_type_test.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_cpp_type_test.cc b/source/blender/blenlib/tests/BLI_cpp_type_test.cc
index f00767eda8c..6a59bedc649 100644
--- a/source/blender/blenlib/tests/BLI_cpp_type_test.cc
+++ b/source/blender/blenlib/tests/BLI_cpp_type_test.cc
@@ -381,4 +381,14 @@ TEST(cpp_type, ToStaticType)
EXPECT_EQ(types[1], &CPPType::get<float>());
}
+TEST(cpp_type, CopyAssignCompressed)
+{
+ std::array<std::string, 5> array = {"a", "b", "c", "d", "e"};
+ std::array<std::string, 3> array_compressed;
+ CPPType::get<std::string>().copy_assign_compressed(&array, &array_compressed, {0, 2, 3});
+ EXPECT_EQ(array_compressed[0], "a");
+ EXPECT_EQ(array_compressed[1], "c");
+ EXPECT_EQ(array_compressed[2], "d");
+}
+
} // namespace blender::tests