Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test buffer works like std::list #410

Merged
merged 3 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sparta/simdb/test/HDF5Database/HDF5Database_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ struct CompoundPOD {
CompoundPOD createRandomCompoundPOD()
{
CompoundPOD comp;
comp.ch = chooseRand<char>();
comp.i1 = chooseRand<int8_t>();
comp.ui1 = chooseRand<uint8_t>();
comp.ch = (char) chooseRand<uint16_t>();
comp.i1 = (int8_t) chooseRand<int16_t>();
comp.ui1 = (uint8_t)chooseRand<uint16_t>();
comp.i2 = chooseRand<int16_t>();
comp.ui2 = chooseRand<uint16_t>();
comp.i4 = chooseRand<int32_t>();
Expand Down Expand Up @@ -210,9 +210,9 @@ struct CompoundWithMatrixPOD
CompoundWithMatrixPOD createRandomCompoundWithMatrixPOD()
{
CompoundWithMatrixPOD comp;
comp.ch = chooseRand<char>();
comp.i1 = chooseRand<int8_t>();
comp.ui1 = chooseRand<uint8_t>();
comp.ch = (char) chooseRand<uint16_t>();
comp.i1 = (int8_t) chooseRand<int16_t>();
comp.ui1 = (uint8_t)chooseRand<uint16_t>();
comp.i2 = chooseRand<int16_t>();
comp.ui2 = chooseRand<uint16_t>();
comp.i4 = chooseRand<int32_t>();
Expand Down
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