Bitcoin Core  22.99.0
P2P Digital Currency
Functions | Variables
uint256_tests.cpp File Reference
#include <arith_uint256.h>
#include <streams.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <version.h>
#include <boost/test/unit_test.hpp>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
Include dependency graph for uint256_tests.cpp:

Go to the source code of this file.

Functions

static std::string ArrayToString (const unsigned char A[], unsigned int width)
 
uint160 uint160S (const char *str)
 
uint160 uint160S (const std::string &str)
 
 BOOST_AUTO_TEST_CASE (basics)
 
 BOOST_AUTO_TEST_CASE (comparison)
 
 BOOST_AUTO_TEST_CASE (methods)
 
 BOOST_AUTO_TEST_CASE (conversion)
 
 BOOST_AUTO_TEST_CASE (operator_with_self)
 
 BOOST_AUTO_TEST_CASE (check_ONE)
 

Variables

const unsigned char R1Array []
 
const char R1ArrayHex [] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"
 
const uint256 R1L = uint256(std::vector<unsigned char>(R1Array,R1Array+32))
 
const uint160 R1S = uint160(std::vector<unsigned char>(R1Array,R1Array+20))
 
const unsigned char R2Array []
 
const uint256 R2L = uint256(std::vector<unsigned char>(R2Array,R2Array+32))
 
const uint160 R2S = uint160(std::vector<unsigned char>(R2Array,R2Array+20))
 
const unsigned char ZeroArray []
 
const uint256 ZeroL = uint256(std::vector<unsigned char>(ZeroArray,ZeroArray+32))
 
const uint160 ZeroS = uint160(std::vector<unsigned char>(ZeroArray,ZeroArray+20))
 
const unsigned char OneArray []
 
const uint256 OneL = uint256(std::vector<unsigned char>(OneArray,OneArray+32))
 
const uint160 OneS = uint160(std::vector<unsigned char>(OneArray,OneArray+20))
 
const unsigned char MaxArray []
 
const uint256 MaxL = uint256(std::vector<unsigned char>(MaxArray,MaxArray+32))
 
const uint160 MaxS = uint160(std::vector<unsigned char>(MaxArray,MaxArray+20))
 

Function Documentation

◆ ArrayToString()

static std::string ArrayToString ( const unsigned char  A[],
unsigned int  width 
)
static

Definition at line 51 of file uint256_tests.cpp.

Here is the caller graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/6]

BOOST_AUTO_TEST_CASE ( basics  )

Definition at line 75 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/6]

BOOST_AUTO_TEST_CASE ( check_ONE  )

Definition at line 282 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/6]

BOOST_AUTO_TEST_CASE ( comparison  )

Definition at line 127 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/6]

BOOST_AUTO_TEST_CASE ( conversion  )

Definition at line 253 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/6]

BOOST_AUTO_TEST_CASE ( methods  )

Definition at line 159 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/6]

BOOST_AUTO_TEST_CASE ( operator_with_self  )

Definition at line 269 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ uint160S() [1/2]

uint160 uint160S ( const char *  str)
inline

Definition at line 62 of file uint256_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint160S() [2/2]

uint160 uint160S ( const std::string &  str)
inline

Definition at line 68 of file uint256_tests.cpp.

Here is the call graph for this function:

Variable Documentation

◆ MaxArray

const unsigned char MaxArray[]
Initial value:
=
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"

Definition at line 45 of file uint256_tests.cpp.

◆ MaxL

const uint256 MaxL = uint256(std::vector<unsigned char>(MaxArray,MaxArray+32))

Definition at line 48 of file uint256_tests.cpp.

◆ MaxS

const uint160 MaxS = uint160(std::vector<unsigned char>(MaxArray,MaxArray+20))

Definition at line 49 of file uint256_tests.cpp.

◆ OneArray

const unsigned char OneArray[]
Initial value:
=
"\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

Definition at line 39 of file uint256_tests.cpp.

◆ OneL

const uint256 OneL = uint256(std::vector<unsigned char>(OneArray,OneArray+32))

Definition at line 42 of file uint256_tests.cpp.

◆ OneS

const uint160 OneS = uint160(std::vector<unsigned char>(OneArray,OneArray+20))

Definition at line 43 of file uint256_tests.cpp.

◆ R1Array

const unsigned char R1Array[]
Initial value:
=
"\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2"
"\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d"

Definition at line 20 of file uint256_tests.cpp.

◆ R1ArrayHex

const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"

Definition at line 23 of file uint256_tests.cpp.

◆ R1L

const uint256 R1L = uint256(std::vector<unsigned char>(R1Array,R1Array+32))

Definition at line 24 of file uint256_tests.cpp.

◆ R1S

const uint160 R1S = uint160(std::vector<unsigned char>(R1Array,R1Array+20))

Definition at line 25 of file uint256_tests.cpp.

◆ R2Array

const unsigned char R2Array[]
Initial value:
=
"\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf"
"\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7"

Definition at line 27 of file uint256_tests.cpp.

◆ R2L

const uint256 R2L = uint256(std::vector<unsigned char>(R2Array,R2Array+32))

Definition at line 30 of file uint256_tests.cpp.

◆ R2S

const uint160 R2S = uint160(std::vector<unsigned char>(R2Array,R2Array+20))

Definition at line 31 of file uint256_tests.cpp.

◆ ZeroArray

const unsigned char ZeroArray[]
Initial value:
=
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

Definition at line 33 of file uint256_tests.cpp.

◆ ZeroL

const uint256 ZeroL = uint256(std::vector<unsigned char>(ZeroArray,ZeroArray+32))

Definition at line 36 of file uint256_tests.cpp.

◆ ZeroS

const uint160 ZeroS = uint160(std::vector<unsigned char>(ZeroArray,ZeroArray+20))

Definition at line 37 of file uint256_tests.cpp.