BLI: add unit tests for recently added methods

This commit is contained in:
Jacques Lucke 2021-04-17 19:06:32 +02:00
parent eff2b89446
commit 1a010450bc
2 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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;