Skip to content

Commit

Permalink
test databuf::check()
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Oct 20, 2024
1 parent f011b6e commit a9e3eea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/testutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ namespace
d.put(3);
assert(d.remaining() == 3);
}

void test_databuf_check()
{
std::printf("Testing databuf<>::check\n");
std::array<int, 4> buf;
databuf<int> d(buf.data(),4);
assert(d.check(4) == true);
assert(d.check(5) == false);
d.put(3);
assert(d.check(4) == false);
assert(d.check(3) == true);
}
}

void testutils()
Expand All @@ -351,4 +363,5 @@ testing tools functionality\n\
test_databuf_reset();
test_databuf_empty();
test_databuf_remaining();
test_databuf_check();
}

0 comments on commit a9e3eea

Please sign in to comment.