Skip to content

Commit

Permalink
test buffer works like std::list
Browse files Browse the repository at this point in the history
  • Loading branch information
shuzhih authored and klingaard committed Mar 5, 2023
1 parent f649235 commit 5822098
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sparta/test/Buffer/Buffer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,15 @@ void generalTest()

// Test erase method.
buf_inf_iter = buf_inf.begin();
const auto buf_inf_iter_nx4 = std::next(buf_inf_iter, 4);
const auto expected_result = *buf_inf_iter_nx4;
// Erase zeroeth element.
EXPECT_NOTHROW(buf_inf.erase(buf_inf_iter));
// iterator isn't invalidated by removing older elements
EXPECT_EQUAL(buf_inf.read(3), expected_result);
buf_inf_iter = buf_inf.begin();
const auto buf_inf_iter_nx3 = std::next(buf_inf_iter, 3);
EXPECT_TRUE(buf_inf_iter_nx3 == buf_inf_iter_nx4);

buf_inf_iter = buf_inf.begin();
buf_inf_iter_nx = std::next(buf_inf_iter, 4);
Expand Down

0 comments on commit 5822098

Please sign in to comment.