diff options
author | Jacques Lucke <jacques@blender.org> | 2021-04-17 20:06:32 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-04-17 20:06:48 +0300 |
commit | 1a010450bc5aa563ef2137facbbdcb33a82661c5 (patch) | |
tree | b944349cb74548276b35ef681cdc46022b5184ba | |
parent | eff2b894464caa83550bcc72d75e3427dfcb4ceb (diff) |
BLI: add unit tests for recently added methods
-rw-r--r-- | source/blender/blenlib/tests/BLI_stack_cxx_test.cc | 9 | ||||
-rw-r--r-- | source/blender/blenlib/tests/BLI_vector_test.cc | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc index f1fcdae3a52..b3108381d78 100644 --- a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc @@ -93,6 +93,15 @@ TEST(stack, Push) EXPECT_EQ(stack.size(), 2); } +TEST(stack, PushAs) +{ + Stack<StringRef> stack; + stack.push_as("hello", 3); + stack.push_as("world", 1); + EXPECT_EQ(stack.pop(), "w"); + EXPECT_EQ(stack.pop(), "hel"); +} + TEST(stack, PushMultiple) { Stack<int> stack; diff --git a/source/blender/blenlib/tests/BLI_vector_test.cc b/source/blender/blenlib/tests/BLI_vector_test.cc index 462f13c15ab..e8636168308 100644 --- a/source/blender/blenlib/tests/BLI_vector_test.cc +++ b/source/blender/blenlib/tests/BLI_vector_test.cc @@ -248,6 +248,15 @@ TEST(vector, Append) EXPECT_EQ(vec[2], 7); } +TEST(vector, AppendAs) +{ + Vector<StringRef> vec; + vec.append_as("hello", 2); + vec.append_as("world", 3); + EXPECT_EQ(vec[0], "he"); + EXPECT_EQ(vec[1], "wor"); +} + TEST(vector, AppendAndGetIndex) { Vector<int> vec; |