![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
#include <arith_uint256.h>#include <test/util/common.h>#include <uint256.h>#include <boost/test/unit_test.hpp>#include <cmath>#include <cstdint>#include <iomanip>#include <limits>#include <sstream>#include <string>#include <vector>Go to the source code of this file.
Macros | |
| #define | CHECKBITWISEOPERATOR(_A_, _B_, _OP_) |
| #define | CHECKASSIGNMENTOPERATOR(_A_, _B_, _OP_) |
Variables | |
| const unsigned char | R1Array [] |
| const char | R1ArrayHex [] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c" |
| const double | R1Ldouble = 0.4887374590559308955 |
| const arith_uint256 | R1L = arith_uint256V(std::vector<unsigned char>(R1Array,R1Array+32)) |
| const uint64_t | R1LLow64 = 0x121156cfdb4a529cULL |
| const unsigned char | R2Array [] |
| const arith_uint256 | R2L = arith_uint256V(std::vector<unsigned char>(R2Array,R2Array+32)) |
| const unsigned char | ZeroArray [] |
| const arith_uint256 | ZeroL = arith_uint256V(std::vector<unsigned char>(ZeroArray,ZeroArray+32)) |
| const unsigned char | OneArray [] |
| const arith_uint256 | OneL = arith_uint256V(std::vector<unsigned char>(OneArray,OneArray+32)) |
| const unsigned char | MaxArray [] |
| const arith_uint256 | MaxL = arith_uint256V(std::vector<unsigned char>(MaxArray,MaxArray+32)) |
| const arith_uint256 | HalfL = (OneL << 255) |
| uint64_t | Tmp64 = 0xc4dab720d9c7acaaULL |
| arith_uint256 | tmpL = ~ZeroL |
| unsigned char | TmpArray [32] |
| #define CHECKASSIGNMENTOPERATOR | ( | _A_, | |
| _B_, | |||
| _OP_ ) |
Definition at line 218 of file arith_uint256_tests.cpp.
| #define CHECKBITWISEOPERATOR | ( | _A_, | |
| _B_, | |||
| _OP_ ) |
Definition at line 214 of file arith_uint256_tests.cpp.
|
static |
|
inlinestatic |
Convert vector to arith_uint256, via uint256 blob.
Definition at line 22 of file arith_uint256_tests.cpp.
|
static |
| BOOST_AUTO_TEST_CASE | ( | bignum_SetCompact | ) |
| BOOST_AUTO_TEST_CASE | ( | bitwiseOperators | ) |
Definition at line 221 of file arith_uint256_tests.cpp.
| BOOST_AUTO_TEST_CASE | ( | conversion | ) |
| BOOST_AUTO_TEST_CASE | ( | divide | ) |
| BOOST_AUTO_TEST_CASE | ( | methods | ) |
| BOOST_AUTO_TEST_CASE | ( | multiply | ) |
| BOOST_AUTO_TEST_CASE | ( | operator_with_self | ) |
Definition at line 581 of file arith_uint256_tests.cpp.
| BOOST_AUTO_TEST_CASE | ( | plusMinus | ) |
| BOOST_AUTO_TEST_CASE | ( | shifts | ) |
| BOOST_CHECK | ( | ! | R1L > ~~R1L | ) |
| BOOST_CHECK | ( | ! | R1L< ~~R1L | ) |
| BOOST_CHECK | ( | ! | ~~R1L > R1L | ) |
| BOOST_CHECK | ( | ! | ~~R1L< R1L | ) |
| BOOST_CHECK | ( | (arith_uint256(R1L^R2L)^R2L) | = =R1L | ) |
| BOOST_CHECK | ( | - | ZeroL = =ZeroL | ) |
| BOOST_CHECK | ( | arith_uint256(OneL) | = =OneL | ) |
| BOOST_CHECK | ( | arith_uint256(R1L) | = =R1L | ) |
| BOOST_CHECK | ( | arith_uint256(ZeroL) | = =ZeroL | ) |
| BOOST_CHECK | ( | arith_uint256V(std::vector< unsigned char >(TmpArray, TmpArray+32)) | = =(~R1L) | ) |
| BOOST_CHECK | ( | MaxL. | ToString() = =ArrayToString(MaxArray, 32) | ) |
| BOOST_CHECK | ( | OneL.ToString() ! | = ArrayToString(ZeroArray, 32) | ) |
| BOOST_CHECK | ( | OneL. | ToString() = =ArrayToString(OneArray, 32) | ) |
| BOOST_CHECK | ( | R1L >=~~ | R1L | ) |
| BOOST_CHECK | ( | R1L. | ToString() = =ArrayToString(R1Array, 32) | ) |
| BOOST_CHECK | ( | R1L<=~~ | R1L | ) |
| BOOST_CHECK | ( | R2L. | ToString() = =ArrayToString(R2Array, 32) | ) |
| BOOST_CHECK | ( | ZeroL. | ToString() = =ArrayToString(ZeroArray, 32) | ) |
| BOOST_CHECK | ( | ~ | MaxL = =ZeroL | ) |
| BOOST_CHECK | ( | ~~R1L >= | R1L | ) |
| BOOST_CHECK | ( | ~~R1L<= | R1L | ) |
| BOOST_CHECK_EQUAL | ( | arith_uint256{0xffffffffffffffff} | , |
| arith_uint256{0xffffffffffffffffULL} | ) |
| BOOST_CHECK_EQUAL | ( | OneL | , |
| arith_uint256{1} | ) |
| BOOST_CHECK_EQUAL | ( | R1L &arith_uint256{0xffffffffffffffff} | , |
| arith_uint256{R1LLow64} | ) |
| BOOST_CHECK_EQUAL | ( | UintToArith256(uint256::FromHex(MaxL.ToString()).value()) | , |
| MaxL | ) |
| BOOST_CHECK_EQUAL | ( | UintToArith256(uint256::FromHex(OneL.ToString()).value()) | , |
| OneL | ) |
| BOOST_CHECK_EQUAL | ( | UintToArith256(uint256::FromHex(R1ArrayHex).value()) | , |
| R1L | ) |
| BOOST_CHECK_EQUAL | ( | UintToArith256(uint256::FromHex(R1L.ToString()).value()) | , |
| R1L | ) |
| BOOST_CHECK_EQUAL | ( | UintToArith256(uint256::FromHex(R2L.ToString()).value()) | , |
| R2L | ) |
| BOOST_CHECK_EQUAL | ( | UintToArith256(uint256::FromHex(ZeroL.ToString()).value()) | , |
| ZeroL | ) |
| BOOST_CHECK_EQUAL | ( | ZeroL | , |
| arith_uint256{0} | ) |
| for | ( | ) | == (MaxL << i)) |
|
static |
|
static |
| const arith_uint256 HalfL = (OneL << 255) |
Definition at line 54 of file arith_uint256_tests.cpp.
| const unsigned char MaxArray[] |
Definition at line 49 of file arith_uint256_tests.cpp.
| const arith_uint256 MaxL = arith_uint256V(std::vector<unsigned char>(MaxArray,MaxArray+32)) |
Definition at line 52 of file arith_uint256_tests.cpp.
| const unsigned char OneArray[] |
Definition at line 44 of file arith_uint256_tests.cpp.
| const arith_uint256 OneL = arith_uint256V(std::vector<unsigned char>(OneArray,OneArray+32)) |
Definition at line 47 of file arith_uint256_tests.cpp.
| const unsigned char R1Array[] |
Definition at line 26 of file arith_uint256_tests.cpp.
| const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c" |
Definition at line 29 of file arith_uint256_tests.cpp.
| BOOST_CHECK_LT * R1L = arith_uint256V(std::vector<unsigned char>(R1Array,R1Array+32)) |
Definition at line 31 of file arith_uint256_tests.cpp.
| const double R1Ldouble = 0.4887374590559308955 |
Definition at line 30 of file arith_uint256_tests.cpp.
| const uint64_t R1LLow64 = 0x121156cfdb4a529cULL |
Definition at line 32 of file arith_uint256_tests.cpp.
| const unsigned char R2Array[] |
Definition at line 34 of file arith_uint256_tests.cpp.
| BOOST_CHECK_LT * R2L = arith_uint256V(std::vector<unsigned char>(R2Array,R2Array+32)) |
Definition at line 37 of file arith_uint256_tests.cpp.
| uint64_t Tmp64 = 0xc4dab720d9c7acaaULL |
Definition at line 85 of file arith_uint256_tests.cpp.
| unsigned char TmpArray |
Definition at line 201 of file arith_uint256_tests.cpp.
| tmpL = ~ZeroL |
Definition at line 116 of file arith_uint256_tests.cpp.
| const unsigned char ZeroArray[] |
Definition at line 39 of file arith_uint256_tests.cpp.
| const arith_uint256 ZeroL = arith_uint256V(std::vector<unsigned char>(ZeroArray,ZeroArray+32)) |
Definition at line 42 of file arith_uint256_tests.cpp.