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:
Diffstat (limited to 'source/blender/blenlib/tests/BLI_generic_array_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_generic_array_test.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenlib/tests/BLI_generic_array_test.cc b/source/blender/blenlib/tests/BLI_generic_array_test.cc
index 52bc7728a6a..8e32430eede 100644
--- a/source/blender/blenlib/tests/BLI_generic_array_test.cc
+++ b/source/blender/blenlib/tests/BLI_generic_array_test.cc
@@ -20,7 +20,7 @@ TEST(generic_array, TypeConstructor)
TEST(generic_array, MoveConstructor)
{
- GArray array_a(CPPType::get<int32_t>(), (int64_t)10);
+ GArray array_a(CPPType::get<int32_t>(), int64_t(10));
GMutableSpan span_a = array_a.as_mutable_span();
MutableSpan<int32_t> typed_span_a = span_a.typed<int32_t>();
typed_span_a.fill(42);
@@ -40,7 +40,7 @@ TEST(generic_array, MoveConstructor)
TEST(generic_array, CopyConstructor)
{
- GArray array_a(CPPType::get<int32_t>(), (int64_t)10);
+ GArray array_a(CPPType::get<int32_t>(), int64_t(10));
GMutableSpan span_a = array_a.as_mutable_span();
MutableSpan<int32_t> typed_span_a = span_a.typed<int32_t>();
typed_span_a.fill(42);
@@ -79,7 +79,7 @@ TEST(generic_array, BufferAndSizeConstructor)
TEST(generic_array, Reinitialize)
{
- GArray array(CPPType::get<int32_t>(), (int64_t)5);
+ GArray array(CPPType::get<int32_t>(), int64_t(5));
EXPECT_FALSE(array.data() == nullptr);
GMutableSpan span = array.as_mutable_span();
MutableSpan<int32_t> typed_span = span.typed<int32_t>();
@@ -106,7 +106,7 @@ TEST(generic_array, InContainer)
{
blender::Array<GArray<>> arrays;
for (GArray<> &array : arrays) {
- array = GArray(CPPType::get<int32_t>(), (int64_t)5);
+ array = GArray(CPPType::get<int32_t>(), int64_t(5));
array.as_mutable_span().typed<int32_t>().fill(55);
}
for (GArray<> &array : arrays) {
@@ -114,4 +114,13 @@ TEST(generic_array, InContainer)
}
}
+TEST(generic_array, ReinitEmpty)
+{
+ GArray<> array(CPPType::get<int>());
+ array.reinitialize(10);
+ array.as_mutable_span().typed<int>()[9] = 7;
+ EXPECT_EQ(array.size(), 10);
+ EXPECT_EQ(array.as_span().typed<int>()[9], 7);
+}
+
} // namespace blender::tests