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-02-24 16:45:41 +0300
committerJacques Lucke <jacques@blender.org>2022-02-24 16:50:13 +0300
commit9be720d85efb307ad37b73f0f5fffd95629c7e20 (patch)
tree8b0c0f074c9f6616ff2b79992974177b2d4215ef /source/blender/blenlib/tests/BLI_vector_test.cc
parent7cab7eb3d6cd929f5c354416b4baa6c608f08d82 (diff)
BLI: support accessing nth last element in Array/Span/Vector
This often helps to make the intend of code more clear compared to computing the index manually in the caller.
Diffstat (limited to 'source/blender/blenlib/tests/BLI_vector_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_vector_test.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_vector_test.cc b/source/blender/blenlib/tests/BLI_vector_test.cc
index 40cda20c395..29b6d2b41fe 100644
--- a/source/blender/blenlib/tests/BLI_vector_test.cc
+++ b/source/blender/blenlib/tests/BLI_vector_test.cc
@@ -447,6 +447,9 @@ TEST(vector, Last)
{
Vector<int> a{3, 5, 7};
EXPECT_EQ(a.last(), 7);
+ EXPECT_EQ(a.last(0), 7);
+ EXPECT_EQ(a.last(1), 5);
+ EXPECT_EQ(a.last(2), 3);
}
TEST(vector, AppendNTimes)