12#include <boost/test/unit_test.hpp>
15#define NUM_MULTIPLES_UNIT 100000
18#define NUM_MULTIPLES_CENT 10000
21#define NUM_MULTIPLES_1BTC 10000
24#define NUM_MULTIPLES_50BTC 420000
36bool static TestPair(uint64_t dec, uint64_t enc) {
62 for (uint64_t i = 0; i < 100000; i++)
144 std::vector<unsigned char> pubkey_raw(65, 0);
146 std::copy(x_not_on_curve.
begin(), x_not_on_curve.
end(), &pubkey_raw[1]);
147 CPubKey pubkey_not_on_curve(pubkey_raw);
160 for (
unsigned int compression_id : {4, 5}) {
162 bool success =
DecompressScript(uncompressed_script, compression_id, compressed_script);
static constexpr CAmount COIN
The amount of satoshis in one BTC.
An encapsulated private key.
CPubKey GetPubKey() const
Compute the public key from a private key.
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid())
Serialized script, used inside transaction inputs and outputs.
A reference to a CScript: the Hash160 of its serialization.
const unsigned char * end() const
const unsigned char * begin() const
bool IsFullyValid() const
Determine if this pubkey is fully valid.
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
BOOST_AUTO_TEST_CASE(compress_amounts)
static bool TestEncode(uint64_t in)
static bool TestPair(uint64_t dec, uint64_t enc)
#define NUM_MULTIPLES_CENT
#define NUM_MULTIPLES_1BTC
#define NUM_MULTIPLES_UNIT
static bool TestDecode(uint64_t in)
#define NUM_MULTIPLES_50BTC
bool DecompressScript(CScript &script, unsigned int nSize, const CompressedScript &in)
bool CompressScript(const CScript &script, CompressedScript &out)
uint64_t DecompressAmount(uint64_t x)
uint64_t CompressAmount(uint64_t n)
Compress amount.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
CKey GenerateRandomKey(bool compressed) noexcept
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
std::vector< unsigned char > ToByteVector(const T &in)
static constexpr CAmount CENT