Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
uint256_tests.cpp File Reference
#include <primitives/transaction_identifier.h>
#include <streams.h>
#include <test/util/common.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <boost/test/unit_test.hpp>
#include <iomanip>
#include <sstream>
#include <string>
#include <string_view>
#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)
 BOOST_CHECK_EQUAL (R1S.ToString(), ArrayToString(R1Array, 20))
 BOOST_CHECK_EQUAL (R2L.ToString(), ArrayToString(R2Array, 32))
 BOOST_CHECK_EQUAL (R2S.ToString(), ArrayToString(R2Array, 20))
 BOOST_CHECK_EQUAL (ZeroL.ToString(), ArrayToString(ZeroArray, 32))
 BOOST_CHECK_EQUAL (ZeroS.ToString(), ArrayToString(ZeroArray, 20))
 BOOST_CHECK_EQUAL (OneL.ToString(), ArrayToString(OneArray, 32))
 BOOST_CHECK_EQUAL (OneS.ToString(), ArrayToString(OneArray, 20))
 BOOST_CHECK_EQUAL (MaxL.ToString(), ArrayToString(MaxArray, 32))
 BOOST_CHECK_EQUAL (MaxS.ToString(), ArrayToString(MaxArray, 20))
 BOOST_CHECK_NE (OneL.ToString(), ArrayToString(ZeroArray, 32))
 BOOST_CHECK_NE (OneS.ToString(), ArrayToString(ZeroArray, 20))
 BOOST_CHECK_NE (R1L, R2L)
 BOOST_CHECK_NE (R1S, R2S)
 BOOST_CHECK_NE (ZeroL, OneL)
 BOOST_CHECK_NE (ZeroS, OneS)
 BOOST_CHECK_NE (OneL, ZeroL)
 BOOST_CHECK_NE (OneS, ZeroS)
 BOOST_CHECK_NE (MaxL, ZeroL)
 BOOST_CHECK_NE (MaxS, ZeroS)
 BOOST_CHECK_EQUAL (uint256::FromHex(R1L.ToString()).value(), R1L)
 BOOST_CHECK_EQUAL (uint256::FromHex(R2L.ToString()).value(), R2L)
 BOOST_CHECK_EQUAL (uint256::FromHex(ZeroL.ToString()).value(), ZeroL)
 BOOST_CHECK_EQUAL (uint256::FromHex(OneL.ToString()).value(), OneL)
 BOOST_CHECK_EQUAL (uint256::FromHex(MaxL.ToString()).value(), MaxL)
 BOOST_CHECK_EQUAL (uint256::FromHex(R1ArrayHex).value(), R1L)
 BOOST_CHECK_EQUAL (uint256(R1L), R1L)
 BOOST_CHECK_EQUAL (uint256(ZeroL), ZeroL)
 BOOST_CHECK_EQUAL (uint256(OneL), OneL)
 BOOST_CHECK_EQUAL (uint160::FromHex(R1S.ToString()).value(), R1S)
 BOOST_CHECK_EQUAL (uint160::FromHex(R2S.ToString()).value(), R2S)
 BOOST_CHECK_EQUAL (uint160::FromHex(ZeroS.ToString()).value(), ZeroS)
 BOOST_CHECK_EQUAL (uint160::FromHex(OneS.ToString()).value(), OneS)
 BOOST_CHECK_EQUAL (uint160::FromHex(MaxS.ToString()).value(), MaxS)
 BOOST_CHECK_EQUAL (uint160::FromHex(std::string_view{R1ArrayHex+24, 40}).value(), R1S)
 BOOST_CHECK_EQUAL (uint160(R1S), R1S)
 BOOST_CHECK_EQUAL (uint160(ZeroS), ZeroS)
 BOOST_CHECK_EQUAL (uint160(OneS), OneS)
 for (int i=255;i >=0;--i)
 BOOST_CHECK_LT (ZeroL, R1L)
 BOOST_CHECK_LT (R2L, R1L)
 BOOST_CHECK_LT (ZeroL, OneL)
 BOOST_CHECK_LT (OneL, MaxL)
 BOOST_CHECK_LT (R1L, MaxL)
 BOOST_CHECK_LT (R2L, MaxL)
 BOOST_CHECK_LT (ZeroS, R1S)
 BOOST_CHECK_LT (R2S, R1S)
 BOOST_CHECK_LT (ZeroS, OneS)
 BOOST_CHECK_LT (OneS, MaxS)
 BOOST_CHECK_LT (R1S, MaxS)
 BOOST_CHECK_LT (R2S, MaxS)
 BOOST_CHECK_LT (uint256{"1000000000000000000000000000000000000000000000000000000000000000"}, uint256{"0000000000000000000000000000000000000000000000000000000000000001"})
 BOOST_CHECK_EQUAL (R2L.GetHex(), R2L.ToString())
 BOOST_CHECK_EQUAL (OneL.GetHex(), OneL.ToString())
 BOOST_CHECK_EQUAL (MaxL.GetHex(), MaxL.ToString())
 BOOST_CHECK_EQUAL (TmpL, R1L)
 BOOST_CHECK_EQUAL (uint256::FromHex(ZeroL.ToString()).value(), uint256())
 BOOST_CHECK_EQUAL_COLLECTIONS (R1L.begin(), R1L.end(), R1Array, R1Array+uint256::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (TmpL.begin(), TmpL.end(), R1Array, R1Array+uint256::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (R2L.begin(), R2L.end(), R2Array, R2Array+uint256::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (ZeroL.begin(), ZeroL.end(), ZeroArray, ZeroArray+uint256::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (OneL.begin(), OneL.end(), OneArray, OneArray+uint256::size())
 BOOST_CHECK_EQUAL (R1L.size(), sizeof(R1L))
 BOOST_CHECK_EQUAL (sizeof(R1L), 32)
 BOOST_CHECK_EQUAL (R1L.size(), 32)
 BOOST_CHECK_EQUAL (R2L.size(), 32)
 BOOST_CHECK_EQUAL (ZeroL.size(), 32)
 BOOST_CHECK_EQUAL (MaxL.size(), 32)
 BOOST_CHECK_EQUAL (R1L.begin()+32, R1L.end())
 BOOST_CHECK_EQUAL (R2L.begin()+32, R2L.end())
 BOOST_CHECK_EQUAL (OneL.begin()+32, OneL.end())
 BOOST_CHECK_EQUAL (MaxL.begin()+32, MaxL.end())
 BOOST_CHECK_EQUAL (TmpL.begin()+32, TmpL.end())
 BOOST_CHECK_EQUAL (GetSerializeSize(R1L), 32)
 BOOST_CHECK_EQUAL (GetSerializeSize(ZeroL), 32)
 BOOST_CHECK_EQUAL (R1L, TmpL)
ss clear ()
 BOOST_CHECK_EQUAL (ZeroL, TmpL)
 BOOST_CHECK_EQUAL (MaxL, TmpL)
 BOOST_CHECK_EQUAL (R1S.GetHex(), R1S.ToString())
 BOOST_CHECK_EQUAL (R2S.GetHex(), R2S.ToString())
 BOOST_CHECK_EQUAL (OneS.GetHex(), OneS.ToString())
 BOOST_CHECK_EQUAL (MaxS.GetHex(), MaxS.ToString())
 BOOST_CHECK_EQUAL (TmpS, R1S)
 BOOST_CHECK_EQUAL (uint160::FromHex(ZeroS.ToString()).value(), uint160())
 BOOST_CHECK_EQUAL_COLLECTIONS (R1S.begin(), R1S.end(), R1Array, R1Array+uint160::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (TmpS.begin(), TmpS.end(), R1Array, R1Array+uint160::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (R2S.begin(), R2S.end(), R2Array, R2Array+uint160::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (ZeroS.begin(), ZeroS.end(), ZeroArray, ZeroArray+uint160::size())
 BOOST_CHECK_EQUAL_COLLECTIONS (OneS.begin(), OneS.end(), OneArray, OneArray+uint160::size())
 BOOST_CHECK_EQUAL (R1S.size(), sizeof(R1S))
 BOOST_CHECK_EQUAL (sizeof(R1S), 20)
 BOOST_CHECK_EQUAL (R1S.size(), 20)
 BOOST_CHECK_EQUAL (R2S.size(), 20)
 BOOST_CHECK_EQUAL (ZeroS.size(), 20)
 BOOST_CHECK_EQUAL (MaxS.size(), 20)
 BOOST_CHECK_EQUAL (R1S.begin()+20, R1S.end())
 BOOST_CHECK_EQUAL (R2S.begin()+20, R2S.end())
 BOOST_CHECK_EQUAL (OneS.begin()+20, OneS.end())
 BOOST_CHECK_EQUAL (MaxS.begin()+20, MaxS.end())
 BOOST_CHECK_EQUAL (TmpS.begin()+20, TmpS.end())
 BOOST_CHECK_EQUAL (GetSerializeSize(R1S), 20)
 BOOST_CHECK_EQUAL (GetSerializeSize(ZeroS), 20)
 BOOST_CHECK_EQUAL (R1S, TmpS)
 BOOST_CHECK_EQUAL (ZeroS, TmpS)
 BOOST_CHECK_EQUAL (MaxS, TmpS)
template<typename T>
void TestFromHex ()
 Implemented as a templated function so it can be reused by other classes that have a FromHex() method that wraps base_blob::FromHex(), such as transaction_identifier::FromHex().
 BOOST_AUTO_TEST_CASE (from_hex)
 BOOST_AUTO_TEST_CASE (from_user_hex)
 BOOST_AUTO_TEST_CASE (check_ONE)
 BOOST_AUTO_TEST_CASE (FromHex_vs_uint256)

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))
uint160 LastS
uint256 TmpL (R1L) = uint256::FromHex(R1L.ToString()).value()
DataStream ss {}
uint160 TmpS (R1S) = uint160::FromHex(R1S.ToString()).value()

Function Documentation

◆ ArrayToString()

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

Definition at line 52 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( check_ONE )

Definition at line 326 of file uint256_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( from_hex )

Definition at line 289 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( from_user_hex )

Definition at line 297 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( FromHex_vs_uint256 )

Definition at line 332 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [1/70]

BOOST_CHECK_EQUAL ( GetSerializeSize(R1L) ,
32  )

◆ BOOST_CHECK_EQUAL() [2/70]

BOOST_CHECK_EQUAL ( GetSerializeSize(R1S) ,
20  )

◆ BOOST_CHECK_EQUAL() [3/70]

BOOST_CHECK_EQUAL ( GetSerializeSize(ZeroL) ,
32  )

◆ BOOST_CHECK_EQUAL() [4/70]

BOOST_CHECK_EQUAL ( GetSerializeSize(ZeroS) ,
20  )

◆ BOOST_CHECK_EQUAL() [5/70]

BOOST_CHECK_EQUAL ( MaxL ,
TmpL  )

◆ BOOST_CHECK_EQUAL() [6/70]

BOOST_CHECK_EQUAL ( MaxL.begin()+ 32,
MaxL. end() )

◆ BOOST_CHECK_EQUAL() [7/70]

BOOST_CHECK_EQUAL ( MaxL. GetHex(),
MaxL. ToString() )

◆ BOOST_CHECK_EQUAL() [8/70]

BOOST_CHECK_EQUAL ( MaxL. size(),
32  )

◆ BOOST_CHECK_EQUAL() [9/70]

BOOST_CHECK_EQUAL ( MaxL. ToString(),
ArrayToString(MaxArray, 32)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [10/70]

BOOST_CHECK_EQUAL ( MaxS ,
TmpS  )

◆ BOOST_CHECK_EQUAL() [11/70]

BOOST_CHECK_EQUAL ( MaxS.begin()+ 20,
MaxS. end() )

◆ BOOST_CHECK_EQUAL() [12/70]

BOOST_CHECK_EQUAL ( MaxS. GetHex(),
MaxS. ToString() )

◆ BOOST_CHECK_EQUAL() [13/70]

BOOST_CHECK_EQUAL ( MaxS. size(),
20  )

◆ BOOST_CHECK_EQUAL() [14/70]

BOOST_CHECK_EQUAL ( MaxS. ToString(),
ArrayToString(MaxArray, 20)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [15/70]

BOOST_CHECK_EQUAL ( OneL.begin()+ 32,
OneL. end() )

◆ BOOST_CHECK_EQUAL() [16/70]

BOOST_CHECK_EQUAL ( OneL. GetHex(),
OneL. ToString() )

◆ BOOST_CHECK_EQUAL() [17/70]

BOOST_CHECK_EQUAL ( OneL. ToString(),
ArrayToString(OneArray, 32)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [18/70]

BOOST_CHECK_EQUAL ( OneS.begin()+ 20,
OneS. end() )

◆ BOOST_CHECK_EQUAL() [19/70]

BOOST_CHECK_EQUAL ( OneS. GetHex(),
OneS. ToString() )

◆ BOOST_CHECK_EQUAL() [20/70]

BOOST_CHECK_EQUAL ( OneS. ToString(),
ArrayToString(OneArray, 20)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [21/70]

BOOST_CHECK_EQUAL ( R1L ,
TmpL  )

◆ BOOST_CHECK_EQUAL() [22/70]

BOOST_CHECK_EQUAL ( R1L.begin()+ 32,
R1L. end() )

◆ BOOST_CHECK_EQUAL() [23/70]

BOOST_CHECK_EQUAL ( R1L. size(),
32  )

◆ BOOST_CHECK_EQUAL() [24/70]

BOOST_CHECK_EQUAL ( R1L. size(),
sizeof(R1L)  )

◆ BOOST_CHECK_EQUAL() [25/70]

BOOST_CHECK_EQUAL ( R1S ,
TmpS  )

◆ BOOST_CHECK_EQUAL() [26/70]

BOOST_CHECK_EQUAL ( R1S.begin()+ 20,
R1S. end() )

◆ BOOST_CHECK_EQUAL() [27/70]

BOOST_CHECK_EQUAL ( R1S. GetHex(),
R1S. ToString() )

◆ BOOST_CHECK_EQUAL() [28/70]

BOOST_CHECK_EQUAL ( R1S. size(),
20  )

◆ BOOST_CHECK_EQUAL() [29/70]

BOOST_CHECK_EQUAL ( R1S. size(),
sizeof(R1S)  )

◆ BOOST_CHECK_EQUAL() [30/70]

BOOST_CHECK_EQUAL ( R1S. ToString(),
ArrayToString(R1Array, 20)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [31/70]

BOOST_CHECK_EQUAL ( R2L.begin()+ 32,
R2L. end() )

◆ BOOST_CHECK_EQUAL() [32/70]

BOOST_CHECK_EQUAL ( R2L. GetHex(),
R2L. ToString() )

◆ BOOST_CHECK_EQUAL() [33/70]

BOOST_CHECK_EQUAL ( R2L. size(),
32  )

◆ BOOST_CHECK_EQUAL() [34/70]

BOOST_CHECK_EQUAL ( R2L. ToString(),
ArrayToString(R2Array, 32)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [35/70]

BOOST_CHECK_EQUAL ( R2S.begin()+ 20,
R2S. end() )

◆ BOOST_CHECK_EQUAL() [36/70]

BOOST_CHECK_EQUAL ( R2S. GetHex(),
R2S. ToString() )

◆ BOOST_CHECK_EQUAL() [37/70]

BOOST_CHECK_EQUAL ( R2S. size(),
20  )

◆ BOOST_CHECK_EQUAL() [38/70]

BOOST_CHECK_EQUAL ( R2S. ToString(),
ArrayToString(R2Array, 20)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [39/70]

BOOST_CHECK_EQUAL ( sizeof(R1L) ,
32  )

◆ BOOST_CHECK_EQUAL() [40/70]

BOOST_CHECK_EQUAL ( sizeof(R1S) ,
20  )

◆ BOOST_CHECK_EQUAL() [41/70]

BOOST_CHECK_EQUAL ( TmpL ,
R1L  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [42/70]

BOOST_CHECK_EQUAL ( TmpL.begin()+ 32,
TmpL. end() )

◆ BOOST_CHECK_EQUAL() [43/70]

BOOST_CHECK_EQUAL ( TmpS ,
R1S  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [44/70]

BOOST_CHECK_EQUAL ( TmpS.begin()+ 20,
TmpS. end() )

◆ BOOST_CHECK_EQUAL() [45/70]

BOOST_CHECK_EQUAL ( uint160(OneS) ,
OneS  )

◆ BOOST_CHECK_EQUAL() [46/70]

BOOST_CHECK_EQUAL ( uint160(R1S) ,
R1S  )

◆ BOOST_CHECK_EQUAL() [47/70]

BOOST_CHECK_EQUAL ( uint160(ZeroS) ,
ZeroS  )

◆ BOOST_CHECK_EQUAL() [48/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(MaxS.ToString()).value() ,
MaxS  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [49/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(OneS.ToString()).value() ,
OneS  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [50/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(R1S.ToString()).value() ,
R1S  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [51/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(R2S.ToString()).value() ,
R2S  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [52/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(std::string_view{R1ArrayHex+24, 40}).value() ,
R1S  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [53/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(ZeroS.ToString()).value() ,
uint160()  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [54/70]

BOOST_CHECK_EQUAL ( uint160::FromHex(ZeroS.ToString()).value() ,
ZeroS  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [55/70]

BOOST_CHECK_EQUAL ( uint256(OneL) ,
OneL  )

◆ BOOST_CHECK_EQUAL() [56/70]

BOOST_CHECK_EQUAL ( uint256(R1L) ,
R1L  )

◆ BOOST_CHECK_EQUAL() [57/70]

BOOST_CHECK_EQUAL ( uint256(ZeroL) ,
ZeroL  )

◆ BOOST_CHECK_EQUAL() [58/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(MaxL.ToString()).value() ,
MaxL  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [59/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(OneL.ToString()).value() ,
OneL  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [60/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(R1ArrayHex).value() ,
R1L  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [61/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(R1L.ToString()).value() ,
R1L  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [62/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(R2L.ToString()).value() ,
R2L  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [63/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(ZeroL.ToString()).value() ,
uint256()  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [64/70]

BOOST_CHECK_EQUAL ( uint256::FromHex(ZeroL.ToString()).value() ,
ZeroL  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [65/70]

BOOST_CHECK_EQUAL ( ZeroL ,
TmpL  )

◆ BOOST_CHECK_EQUAL() [66/70]

BOOST_CHECK_EQUAL ( ZeroL. size(),
32  )

◆ BOOST_CHECK_EQUAL() [67/70]

BOOST_CHECK_EQUAL ( ZeroL. ToString(),
ArrayToString(ZeroArray, 32)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL() [68/70]

BOOST_CHECK_EQUAL ( ZeroS ,
TmpS  )

◆ BOOST_CHECK_EQUAL() [69/70]

BOOST_CHECK_EQUAL ( ZeroS. size(),
20  )

◆ BOOST_CHECK_EQUAL() [70/70]

BOOST_CHECK_EQUAL ( ZeroS. ToString(),
ArrayToString(ZeroArray, 20)  )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [1/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( OneL. begin(),
OneL. end(),
OneArray ,
OneArray+ uint256::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [2/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( OneS. begin(),
OneS. end(),
OneArray ,
OneArray+ uint160::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [3/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( R1L. begin(),
R1L. end(),
R1Array ,
R1Array+ uint256::size() )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [4/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( R1S. begin(),
R1S. end(),
R1Array ,
R1Array+ uint160::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [5/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( R2L. begin(),
R2L. end(),
R2Array ,
R2Array+ uint256::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [6/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( R2S. begin(),
R2S. end(),
R2Array ,
R2Array+ uint160::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [7/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( TmpL. begin(),
TmpL. end(),
R1Array ,
R1Array+ uint256::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [8/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( TmpS. begin(),
TmpS. end(),
R1Array ,
R1Array+ uint160::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [9/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( ZeroL. begin(),
ZeroL. end(),
ZeroArray ,
ZeroArray+ uint256::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_EQUAL_COLLECTIONS() [10/10]

BOOST_CHECK_EQUAL_COLLECTIONS ( ZeroS. begin(),
ZeroS. end(),
ZeroArray ,
ZeroArray+ uint160::size() )
Here is the call graph for this function:

◆ BOOST_CHECK_LT() [1/13]

BOOST_CHECK_LT ( OneL ,
MaxL  )

◆ BOOST_CHECK_LT() [2/13]

BOOST_CHECK_LT ( OneS ,
MaxS  )

◆ BOOST_CHECK_LT() [3/13]

BOOST_CHECK_LT ( R1L ,
MaxL  )

◆ BOOST_CHECK_LT() [4/13]

BOOST_CHECK_LT ( R1S ,
MaxS  )

◆ BOOST_CHECK_LT() [5/13]

BOOST_CHECK_LT ( R2L ,
MaxL  )

◆ BOOST_CHECK_LT() [6/13]

BOOST_CHECK_LT ( R2L ,
R1L  )

◆ BOOST_CHECK_LT() [7/13]

BOOST_CHECK_LT ( R2S ,
MaxS  )

◆ BOOST_CHECK_LT() [8/13]

BOOST_CHECK_LT ( R2S ,
R1S  )

◆ BOOST_CHECK_LT() [9/13]

BOOST_CHECK_LT ( uint256{"1000000000000000000000000000000000000000000000000000000000000000"} ,
uint256{"0000000000000000000000000000000000000000000000000000000000000001"}  )

◆ BOOST_CHECK_LT() [10/13]

BOOST_CHECK_LT ( ZeroL ,
OneL  )

◆ BOOST_CHECK_LT() [11/13]

BOOST_CHECK_LT ( ZeroL ,
R1L  )
Here is the caller graph for this function:

◆ BOOST_CHECK_LT() [12/13]

BOOST_CHECK_LT ( ZeroS ,
OneS  )

◆ BOOST_CHECK_LT() [13/13]

BOOST_CHECK_LT ( ZeroS ,
R1S  )

◆ BOOST_CHECK_NE() [1/10]

BOOST_CHECK_NE ( MaxL ,
ZeroL  )

◆ BOOST_CHECK_NE() [2/10]

BOOST_CHECK_NE ( MaxS ,
ZeroS  )

◆ BOOST_CHECK_NE() [3/10]

BOOST_CHECK_NE ( OneL ,
ZeroL  )

◆ BOOST_CHECK_NE() [4/10]

BOOST_CHECK_NE ( OneL. ToString(),
ArrayToString(ZeroArray, 32)  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BOOST_CHECK_NE() [5/10]

BOOST_CHECK_NE ( OneS ,
ZeroS  )

◆ BOOST_CHECK_NE() [6/10]

BOOST_CHECK_NE ( OneS. ToString(),
ArrayToString(ZeroArray, 20)  )
Here is the call graph for this function:

◆ BOOST_CHECK_NE() [7/10]

BOOST_CHECK_NE ( R1L ,
R2L  )

◆ BOOST_CHECK_NE() [8/10]

BOOST_CHECK_NE ( R1S ,
R2S  )

◆ BOOST_CHECK_NE() [9/10]

BOOST_CHECK_NE ( ZeroL ,
OneL  )

◆ BOOST_CHECK_NE() [10/10]

BOOST_CHECK_NE ( ZeroS ,
OneS  )

◆ clear()

ss clear ( )
Here is the caller graph for this function:

◆ for()

for ( int i = 255; i >= 0; --i)

Definition at line 111 of file uint256_tests.cpp.

Here is the call graph for this function:

◆ TestFromHex()

template<typename T>
void TestFromHex ( )

Implemented as a templated function so it can be reused by other classes that have a FromHex() method that wraps base_blob::FromHex(), such as transaction_identifier::FromHex().

Definition at line 249 of file uint256_tests.cpp.

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

Variable Documentation

◆ LastS

uint160 LastS

Definition at line 125 of file uint256_tests.cpp.

◆ 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 46 of file uint256_tests.cpp.

◆ MaxL

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

Definition at line 49 of file uint256_tests.cpp.

◆ MaxS

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

Definition at line 50 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 40 of file uint256_tests.cpp.

◆ OneL

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

Definition at line 43 of file uint256_tests.cpp.

◆ OneS

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

Definition at line 44 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 21 of file uint256_tests.cpp.

◆ R1ArrayHex

const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"

Definition at line 24 of file uint256_tests.cpp.

◆ R1L

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

Definition at line 25 of file uint256_tests.cpp.

◆ R1S

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

Definition at line 26 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 28 of file uint256_tests.cpp.

◆ R2L

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

Definition at line 31 of file uint256_tests.cpp.

◆ R2S

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

Definition at line 32 of file uint256_tests.cpp.

◆ ss

ss<< MaxS BOOST_CHECK_EQUAL(ss.str(), std::string(MaxArray, MaxArray+20)) ss > TmpS {}

Definition at line 181 of file uint256_tests.cpp.

◆ TmpL

ss<< MaxL; BOOST_CHECK_EQUAL(ss.str(), std::string(MaxArray,MaxArray+32)); ss > TmpL ( R1L ) = uint256::FromHex(R1L.ToString()).value()

Definition at line 161 of file uint256_tests.cpp.

◆ TmpS

ss<< MaxS; BOOST_CHECK_EQUAL(ss.str(), std::string(MaxArray,MaxArray+20)); ss > TmpS ( R1S ) = uint160::FromHex(R1S.ToString()).value()

Definition at line 207 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 34 of file uint256_tests.cpp.

◆ ZeroL

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

Definition at line 37 of file uint256_tests.cpp.

◆ ZeroS

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

Definition at line 38 of file uint256_tests.cpp.