Skip to content

Commit c48737c

Browse files
committed
added more test cases in test suit
1 parent 9ab1db7 commit c48737c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_circularbuffer_int.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class CircularBufferTest : public ::testing::Test{
1414

1515
TEST_F(CircularBufferTest, CapacityTest){
1616
EXPECT_EQ(5, test.capacity());
17+
EXPECT_FALSE(test.capacity() == 0);
1718
}
1819

1920
TEST_F(CircularBufferTest, EmptyTest){
@@ -27,6 +28,7 @@ TEST_F(CircularBufferTest, EmptyTest){
2728
}
2829

2930
TEST_F(CircularBufferTest, PushBackTest){
31+
EXPECT_TRUE(test.empty());
3032
test.push_back(1);
3133
test.push_back(2);
3234
EXPECT_EQ(1, test.front());
@@ -37,6 +39,25 @@ TEST_F(CircularBufferTest, PushBackTest){
3739

3840
}
3941

42+
TEST_F(CircularBufferTest, PopFrontTest){
43+
EXPECT_TRUE(test.empty());
44+
test.push_back(348789);
45+
test.push_back(34824);
46+
test.push_back(234892);
47+
test.push_back(100929);
48+
test.push_back(4878872);
49+
EXPECT_TRUE(test.full());
50+
while(true){
51+
try{
52+
test.pop_front();
53+
}
54+
catch(std::exception& e){
55+
EXPECT_TRUE(test.empty());
56+
break;
57+
}
58+
}
59+
60+
}
4061

4162
TEST_F(CircularBufferTest, SizeTest){
4263
EXPECT_EQ(0, test.size());

0 commit comments

Comments
 (0)