diff options
author | Jacques Lucke <jacques@blender.org> | 2020-08-24 12:51:28 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-08-24 12:51:41 +0300 |
commit | 4883cc572888e281ee27f02b307d6fc827477686 (patch) | |
tree | 38be4a25862faa62c2ddc83bf9b209a420e1dfc7 /source/blender/blenlib/tests | |
parent | afbc727da2514e41406d023dede23ccace422672 (diff) |
BLI: add Array.last method
This makes it consistent with Vector and Span.
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r-- | source/blender/blenlib/tests/BLI_array_test.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_array_test.cc b/source/blender/blenlib/tests/BLI_array_test.cc index 251cff833f7..3d45a9f5277 100644 --- a/source/blender/blenlib/tests/BLI_array_test.cc +++ b/source/blender/blenlib/tests/BLI_array_test.cc @@ -227,4 +227,13 @@ TEST(array, MoveAssignmentExceptions) EXPECT_ANY_THROW({ array_moved = std::move(array); }); } +TEST(array, Last) +{ + Array<int> array = {5, 7, 8, 9}; + EXPECT_EQ(array.last(), 9); + array.last() = 1; + EXPECT_EQ(array[3], 1); + EXPECT_EQ(const_cast<const Array<int> &>(array).last(), 1); +} + } // namespace blender::tests |