// Tests for SafeBuffer. Checks if memory occupied by the buffer is wiped after it's deleted.
-POSITIVE_TEST_CASE(SafeBufferTest_uc_control_group)
+POSITIVE_TEST_CASE(SafeBufferTest)
{
- size_t cnt = buffer_erase_test<std::vector<unsigned char>>();
-
- BOOST_REQUIRE_MESSAGE(cnt > LEN / 2,
+ // Run a control group to check if this kind of test can even work.
+ BOOST_REQUIRE_MESSAGE(buffer_erase_test<std::vector<unsigned char>>() > LEN / 2,
"Less than 1/2 of data matches the original.");
-}
-
-POSITIVE_TEST_CASE(SafeBufferTest_item_control_group)
-{
- size_t cnt = buffer_erase_test<std::vector<Item>>();
-
- BOOST_REQUIRE_MESSAGE(cnt > LEN / 2,
+ BOOST_REQUIRE_MESSAGE(buffer_erase_test<std::vector<Item>>() > LEN / 2,
"Less than 1/2 of data matches the original.");
-}
-POSITIVE_TEST_CASE(SafeBufferTest_uc)
-{
- size_t cnt = buffer_erase_test<RawBuffer>();
-
- BOOST_REQUIRE_MESSAGE(cnt <= LEN / 10,
+ // Actually check whether SafeBuffer erases memory after destruction.
+ BOOST_REQUIRE_MESSAGE(buffer_erase_test<RawBuffer>() <= LEN / 10,
"More than 1/10 of data matches the original.");
-}
-
-POSITIVE_TEST_CASE(SafeBufferTest_item)
-{
- size_t cnt = buffer_erase_test<SafeBuffer<Item>::Type>();
-
- BOOST_REQUIRE_MESSAGE(cnt <= LEN / 10,
+ BOOST_REQUIRE_MESSAGE(buffer_erase_test<SafeBuffer<Item>::Type>() <= LEN / 10,
"More than 1/10 of data matches the original.");
}