Bitcoin Core  22.99.0
P2P Digital Currency
Functions | Variables
scriptnum_tests.cpp File Reference
#include <script/script.h>
#include <test/scriptnum10.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
#include <limits.h>
#include <stdint.h>
Include dependency graph for scriptnum_tests.cpp:

Go to the source code of this file.

Functions

static bool verify (const CScriptNum10 &bignum, const CScriptNum &scriptnum)
 
static void CheckCreateVch (const int64_t &num)
 
static void CheckCreateInt (const int64_t &num)
 
static void CheckAdd (const int64_t &num1, const int64_t &num2)
 
static void CheckNegate (const int64_t &num)
 
static void CheckSubtract (const int64_t &num1, const int64_t &num2)
 
static void CheckCompare (const int64_t &num1, const int64_t &num2)
 
static void RunCreate (const int64_t &num)
 
static void RunOperators (const int64_t &num1, const int64_t &num2)
 
 BOOST_AUTO_TEST_CASE (creation)
 
 BOOST_AUTO_TEST_CASE (operators)
 

Variables

static const int64_t values [] = { 0, 1, -2, 127, 128, -255, 256, (1LL << 15) - 1, -(1LL << 16), (1LL << 24) - 1, (1LL << 31), 1 - (1LL << 32), 1LL << 40 }
 A selection of numbers that do not trigger int64_t overflow when added/subtracted. More...
 
static const int64_t offsets [] = { 1, 0x79, 0x80, 0x81, 0xFF, 0x7FFF, 0x8000, 0xFFFF, 0x10000}
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( creation  )

Definition at line 165 of file scriptnum_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( operators  )

Definition at line 178 of file scriptnum_tests.cpp.

Here is the call graph for this function:

◆ CheckAdd()

static void CheckAdd ( const int64_t &  num1,
const int64_t &  num2 
)
static

Definition at line 52 of file scriptnum_tests.cpp.

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

◆ CheckCompare()

static void CheckCompare ( const int64_t &  num1,
const int64_t &  num2 
)
static

Definition at line 109 of file scriptnum_tests.cpp.

Here is the caller graph for this function:

◆ CheckCreateInt()

static void CheckCreateInt ( const int64_t &  num)
static

Definition at line 41 of file scriptnum_tests.cpp.

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

◆ CheckCreateVch()

static void CheckCreateVch ( const int64_t &  num)
static

Definition at line 26 of file scriptnum_tests.cpp.

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

◆ CheckNegate()

static void CheckNegate ( const int64_t &  num)
static

Definition at line 74 of file scriptnum_tests.cpp.

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

◆ CheckSubtract()

static void CheckSubtract ( const int64_t &  num1,
const int64_t &  num2 
)
static

Definition at line 84 of file scriptnum_tests.cpp.

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

◆ RunCreate()

static void RunCreate ( const int64_t &  num)
static

Definition at line 145 of file scriptnum_tests.cpp.

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

◆ RunOperators()

static void RunOperators ( const int64_t &  num1,
const int64_t &  num2 
)
static

Definition at line 157 of file scriptnum_tests.cpp.

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

◆ verify()

static bool verify ( const CScriptNum10 bignum,
const CScriptNum scriptnum 
)
static

Definition at line 21 of file scriptnum_tests.cpp.

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

Variable Documentation

◆ offsets

const int64_t offsets[] = { 1, 0x79, 0x80, 0x81, 0xFF, 0x7FFF, 0x8000, 0xFFFF, 0x10000}
static

Definition at line 19 of file scriptnum_tests.cpp.

◆ values

const int64_t values[] = { 0, 1, -2, 127, 128, -255, 256, (1LL << 15) - 1, -(1LL << 16), (1LL << 24) - 1, (1LL << 31), 1 - (1LL << 32), 1LL << 40 }
static

A selection of numbers that do not trigger int64_t overflow when added/subtracted.

Definition at line 17 of file scriptnum_tests.cpp.