1#define BOOST_TEST_MODULE blake2
2#include <boost/test/included/unit_test.hpp>
14std::ostream&
operator<<(std::ostream& st,
const std::variant<fc::k1_recover_error, bytes>& err)
16 if(std::holds_alternative<fc::k1_recover_error>(err))
17 st << static_cast<int32_t>(std::get<fc::k1_recover_error>(err));
19 st << fc::to_hex(std::get<bytes>(err));
27 using test_k1_recover = std::tuple<std::string, std::string, std::variant<fc::k1_recover_error, bytes>>;
28 const std::vector<test_k1_recover> tests {
31 "1b323dd47a1dd5592c296ee2ee12e0af38974087a475e99098a440284f19c1f7642fa0baa10a8a3ab800dfdbe987dee68a09b6fa3db45a5cc4f3a5835a1671d4dd",
32 "92390316873c5a9d520b28aba61e7a8f00025ac069acd9c4d2a71d775a55fa5f",
33 to_bytes(
"044424982f5c4044aaf27444965d15b53f219c8ad332bf98a98a902ebfb05d46cb86ea6fe663aa83fd4ce0a383855dfae9bf7a07b779d34c84c347fec79d04c51e")
38 "01174de755b55bd29026d626f7313a5560353dc5175f29c78d79d961b81a0c04360d833ca789bc16d4ee714a6d1a19461d890966e0ec5c074f67be67e631d33aa7",
39 "45fd65f6dd062fe7020f11d19fe5c35dc4d425e1479c0968c8e932c208f25399",
45 "174de755b55bd29026d626f7313a5560353dc5175f29c78d79d961b81a0c04360d833ca789bc16d4ee714a6d1a19461d890966e0ec5c074f67be67e631d33aa7",
46 "45fd65f6dd062fe7020f11d19fe5c35dc4d425e1479c0968c8e932c208f25399",
52 "00174de755b55bd29026d626f7313a5560353dc5175f29c78d79d961b81a0c04360d833ca789bc16d4ee714a6d1a19461d890966e0ec5c074f67be67e631d33aa7",
53 "fd65f6dd062fe7020f11d19fe5c35dc4d425e1479c0968c8e932c208f25399",
59 for(
const auto& test : tests) {
71BOOST_AUTO_TEST_SUITE_END()
Defines exception's used by fc.
fc::sha256 digest(const T &value)
std::variant< k1_recover_error, bytes > k1_recover(const bytes &signature, const bytes &digest)
std::ostream & operator<<(std::ostream &st, const std::variant< fc::alt_bn128_error, bytes > &err)
const unsigned char expected_result[]
BOOST_AUTO_TEST_CASE(recover)
bytes to_bytes(const std::string &source)