Skip to content

Commit

Permalink
Remove <iostream> from test/bytes.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
bifurcation committed Nov 3, 2023
1 parent 180b834 commit e837e49
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/bytes/test/bytes.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <bytes/bytes.h>
#include <doctest/doctest.h>
#include <iostream>
#include <memory>
#include <sstream>

Expand All @@ -24,15 +23,13 @@ TEST_CASE("Zeroization")
const auto* end = begin + size;
vec.reset();

const auto snapshot = std::vector<uint8_t>(begin, end);
std::cout << "snapshot = " << to_hex(snapshot) << std::endl;

// In principle, the memory previously owned by the vector should be all zero
// at this point. However, since this is now unallocated memory, the
// allocator can do with it what it wants, and may have written something to
// it when deallocating. macOS and Linux mostly leave the buffer alone,
// writing a couple of pointers to the beginning. So we look for the buffer
// to be basically all zero.
const auto snapshot = std::vector<uint8_t>(begin, end);
const auto threshold = size - 4 * sizeof(void*);
REQUIRE(std::count(snapshot.begin(), snapshot.end(), 0) >= threshold);
}
Expand Down

0 comments on commit e837e49

Please sign in to comment.