aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-02-01 09:42:25 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-02-01 09:42:34 +0100
commitfcac16fff87b9a949b925831167c2ca5e22eac2c (patch)
tree91f3d329ff4a1441d4dd7869d6372b6633265862 /src
parent8f137e69caeb2a2ffe1aa930bd6fbc49cee4087c (diff)
parentfaa630aa15bbda0f3b0cf3b6f31cf8fdaeb66975 (diff)
downloadbitcoin-fcac16fff87b9a949b925831167c2ca5e22eac2c.tar.xz
Merge bitcoin/bitcoin#24190: test: Fix sanitizer suppresions in streams_tests
faa630aa15bbda0f3b0cf3b6f31cf8fdaeb66975 test: Fix sanitizer suppresions in streams_tests (MarcoFalke) Pull request description: Two changes (that also make sense on their own) to remove the file-wide sanitizer suppression: * `FindByte` no longer takes a `char`, but an `uint8_t`, after commit 196b4599201dbce3e0317e9b98753fa6a244b82d. * The `key` vector of unsigned chars can be removed and inlined as initializer-list. This avoids a bunch of verbose code like `clear()` and `push_back` of `char`s. ACKs for top commit: PastaPastaPasta: utACK faa630aa15bbda0f3b0cf3b6f31cf8fdaeb66975, I have reviewed the changes and agree it makes sense to merge Tree-SHA512: 747b9d4676fad6d07f3955668639c93333625e69199ff4c499f01167de3875990d93db85e775a7f5b1b684575dceaec8aa000b4db15525fc47b699bac1c85e3d
Diffstat (limited to 'src')
-rw-r--r--src/test/streams_tests.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index a8f6cdd4a0..af0f86274e 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -162,14 +162,10 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
{
std::vector<std::byte> in;
std::vector<char> expected_xor;
- std::vector<unsigned char> key;
CDataStream ds(in, 0, 0);
// Degenerate case
-
- key.push_back('\x00');
- key.push_back('\x00');
- ds.Xor(key);
+ ds.Xor({0x00, 0x00});
BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()),
ds.str());
@@ -183,10 +179,8 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
ds.clear();
ds.insert(ds.begin(), in.begin(), in.end());
- key.clear();
- key.push_back('\xff');
- ds.Xor(key);
+ ds.Xor({0xff});
BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()),
ds.str());
@@ -203,11 +197,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
ds.clear();
ds.insert(ds.begin(), in.begin(), in.end());
- key.clear();
- key.push_back('\xff');
- key.push_back('\x0f');
-
- ds.Xor(key);
+ ds.Xor({0xff, 0x0f});
BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()),
ds.str());
@@ -421,7 +411,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
size_t find = currentPos + InsecureRandRange(8);
if (find >= fileSize)
find = fileSize - 1;
- bf.FindByte(static_cast<char>(find));
+ bf.FindByte(uint8_t(find));
// The value at each offset is the offset.
BOOST_CHECK_EQUAL(bf.GetPos(), find);
currentPos = find;