From c18405732e38eadb2c47533c3f982f4605fbfd9a Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 23 Oct 2019 15:08:48 +0000 Subject: tests: Add fuzzing harness for various hex related functions --- src/test/fuzz/hex.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/fuzz/hex.cpp (limited to 'src/test/fuzz/hex.cpp') diff --git a/src/test/fuzz/hex.cpp b/src/test/fuzz/hex.cpp new file mode 100644 index 0000000000..54693180be --- /dev/null +++ b/src/test/fuzz/hex.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include + +#include +#include +#include +#include + +void test_one_input(const std::vector& buffer) +{ + const std::string random_hex_string(buffer.begin(), buffer.end()); + const std::vector data = ParseHex(random_hex_string); + const std::string hex_data = HexStr(data); + if (IsHex(random_hex_string)) { + assert(ToLower(random_hex_string) == hex_data); + } +} -- cgit v1.2.3