#include <boost/test/unit_test.hpp>
#include <stdint.h>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cmath>
#include "uint256.h"
#include "arith_uint256.h"
#include <string>
#include "version.h"
#include "test/test_pivx.h"
Go to the source code of this file.
|
| const unsigned char | R1Array [] |
| |
| const char | R1ArrayHex [] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c" |
| |
| const double | R1Ldouble = 0.4887374590559308955 |
| |
| const double | R1Sdouble = 0.7096329412477836074 |
| |
| const arith_uint256 | R1L = arith_uint256(std::vector<unsigned char>(R1Array,R1Array+32)) |
| |
| const arith_uint160 | R1S = arith_uint160(std::vector<unsigned char>(R1Array,R1Array+20)) |
| |
| const uint64_t | R1LLow64 = 0x121156cfdb4a529cULL |
| |
| const unsigned char | R2Array [] |
| |
| const arith_uint256 | R2L = arith_uint256(std::vector<unsigned char>(R2Array,R2Array+32)) |
| |
| const arith_uint160 | R2S = arith_uint160(std::vector<unsigned char>(R2Array,R2Array+20)) |
| |
| const char | R1LplusR2L [] = "549FB09FEA236A1EA3E31D4D58F1B1369288D204211CA751527CFC175767850C" |
| |
| const unsigned char | ZeroArray [] |
| |
| const arith_uint256 | ZeroL = arith_uint256(std::vector<unsigned char>(ZeroArray,ZeroArray+32)) |
| |
| const arith_uint160 | ZeroS = arith_uint160(std::vector<unsigned char>(ZeroArray,ZeroArray+20)) |
| |
| const unsigned char | OneArray [] |
| |
| const arith_uint256 | OneL = arith_uint256(std::vector<unsigned char>(OneArray,OneArray+32)) |
| |
| const arith_uint160 | OneS = arith_uint160(std::vector<unsigned char>(OneArray,OneArray+20)) |
| |
| const unsigned char | MaxArray [] |
| |
| const arith_uint256 | MaxL = arith_uint256(std::vector<unsigned char>(MaxArray,MaxArray+32)) |
| |
| const arith_uint160 | MaxS = arith_uint160(std::vector<unsigned char>(MaxArray,MaxArray+20)) |
| |
| const arith_uint256 | HalfL = (OneL << 255) |
| |
| const arith_uint160 | HalfS = (OneS << 159) |
| |
◆ CHECKASSIGNMENTOPERATOR
| #define CHECKASSIGNMENTOPERATOR |
( |
|
_A_, |
|
|
|
_B_, |
|
|
|
_OP_ |
|
) |
| |
Value: TmpL = _A_##
L; TmpL _OP_##= _B_##
L;
BOOST_CHECK(TmpL == (_A_##
L _OP_ _B_##
L)); \
TmpS = _A_##
S; TmpS _OP_##= _B_##
S;
BOOST_CHECK(TmpS == (_A_##
S _OP_ _B_##
S));
#define S(x0, x1, x2, x3, cb, r)
#define L(x0, x1, x2, x3, x4, x5, x6, x7)
#define BOOST_CHECK(expr)
Definition at line 330 of file arith_uint256_tests.cpp.
◆ CHECKBITWISEOPERATOR
| #define CHECKBITWISEOPERATOR |
( |
|
_A_, |
|
|
|
_B_, |
|
|
|
_OP_ |
|
) |
| |
Value: for (unsigned int i = 0; i < 32; ++i) { TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; } \
BOOST_CHECK(
arith_uint256(std::vector<unsigned char>(TmpArray,TmpArray+32)) == (_A_##
L _OP_ _B_##
L)); \
for (unsigned int i = 0; i < 20; ++i) { TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; } \
BOOST_CHECK(
arith_uint160(std::vector<unsigned char>(TmpArray,TmpArray+20)) == (_A_##
S _OP_ _B_##
S));
160-bit unsigned big integer.
256-bit unsigned big integer.
Definition at line 324 of file arith_uint256_tests.cpp.
◆ almostEqual()
| bool almostEqual |
( |
double |
d1, |
|
|
double |
d2 |
|
) |
| |
◆ arith_uint256V()
| arith_uint256 arith_uint256V |
( |
const std::vector< unsigned char > & |
vch | ) |
|
|
inline |
◆ ArrayToString()
| std::string ArrayToString |
( |
const unsigned char |
A[], |
|
|
unsigned int |
width |
|
) |
| |
◆ BOOST_AUTO_TEST_CASE() [1/11]
| BOOST_AUTO_TEST_CASE |
( |
basics |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [2/11]
| BOOST_AUTO_TEST_CASE |
( |
bignum_SetCompact |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [3/11]
| BOOST_AUTO_TEST_CASE |
( |
bitwiseOperators |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [4/11]
| BOOST_AUTO_TEST_CASE |
( |
comparison |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [5/11]
| BOOST_AUTO_TEST_CASE |
( |
divide |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [6/11]
| BOOST_AUTO_TEST_CASE |
( |
getmaxcoverage |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [7/11]
| BOOST_AUTO_TEST_CASE |
( |
methods |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [8/11]
| BOOST_AUTO_TEST_CASE |
( |
multiply |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [9/11]
| BOOST_AUTO_TEST_CASE |
( |
plusMinus |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [10/11]
| BOOST_AUTO_TEST_CASE |
( |
shifts |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [11/11]
| BOOST_AUTO_TEST_CASE |
( |
unaryOperators |
| ) |
|
◆ shiftArrayLeft()
| void shiftArrayLeft |
( |
unsigned char * |
to, |
|
|
const unsigned char * |
from, |
|
|
unsigned int |
arrayLength, |
|
|
unsigned int |
bitsToShift |
|
) |
| |
◆ shiftArrayRight()
| void shiftArrayRight |
( |
unsigned char * |
to, |
|
|
const unsigned char * |
from, |
|
|
unsigned int |
arrayLength, |
|
|
unsigned int |
bitsToShift |
|
) |
| |
◆ HalfL
◆ HalfS
◆ 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 56 of file arith_uint256_tests.cpp.
◆ MaxL
◆ MaxS
◆ 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 50 of file arith_uint256_tests.cpp.
◆ OneL
◆ OneS
◆ 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 26 of file arith_uint256_tests.cpp.
◆ R1ArrayHex
| const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c" |
◆ R1L
◆ R1Ldouble
| const double R1Ldouble = 0.4887374590559308955 |
◆ R1LLow64
| const uint64_t R1LLow64 = 0x121156cfdb4a529cULL |
◆ R1LplusR2L
| const char R1LplusR2L[] = "549FB09FEA236A1EA3E31D4D58F1B1369288D204211CA751527CFC175767850C" |
◆ R1S
◆ R1Sdouble
| const double R1Sdouble = 0.7096329412477836074 |
◆ 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 36 of file arith_uint256_tests.cpp.
◆ R2L
◆ R2S
◆ 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 44 of file arith_uint256_tests.cpp.
◆ ZeroL
◆ ZeroS