rippled
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ripple::AmendmentTable_test Class Referencefinal
Inheritance diagram for ripple::AmendmentTable_test:
Inheritance graph
[legend]
Collaboration diagram for ripple::AmendmentTable_test:
Collaboration graph
[legend]

Public Member Functions

 AmendmentTable_test ()
 
std::unique_ptr< AmendmentTablemakeTable (Application &app, std::chrono::seconds majorityTime, std::vector< AmendmentTable::FeatureInfo > const &supported, Section const &enabled, Section const &vetoed)
 
std::unique_ptr< AmendmentTablemakeTable (test::jtx::Env &env, std::chrono::seconds majorityTime, std::vector< AmendmentTable::FeatureInfo > const &supported, Section const &enabled, Section const &vetoed)
 
std::unique_ptr< AmendmentTablemakeTable (test::jtx::Env &env, std::chrono::seconds majorityTime)
 
void testConstruct ()
 
void testGet ()
 
void testBadConfig ()
 
void testEnableVeto ()
 
std::vector< std::pair< PublicKey, SecretKey > > makeValidators (int num)
 
void doRound (uint256 const &feat, AmendmentTable &table, weeks week, std::vector< std::pair< PublicKey, SecretKey >> const &validators, std::vector< std::pair< uint256, int >> const &votes, std::vector< uint256 > &ourVotes, std::set< uint256 > &enabled, majorityAmendments_t &majority)
 
void testNoOnUnknown (uint256 const &feat)
 
void testNoOnVetoed (uint256 const &feat)
 
void testVoteEnable (uint256 const &feat)
 
void testDetectMajority (uint256 const &feat)
 
void testLostMajority (uint256 const &feat)
 
void testHasUnsupported ()
 
void testFeature (uint256 const &feat)
 
void run () override
 

Static Public Member Functions

static NetClock::time_point weekTime (weeks w)
 

Private Member Functions

std::unique_ptr< ConfigmakeConfig ()
 

Static Private Member Functions

static uint256 amendmentId (std::string in)
 
static Section makeSection (std::string const &name, std::vector< std::string > const &amendments)
 
static Section makeSection (std::vector< std::string > const &amendments)
 
static Section makeSection (uint256 const &amendment)
 
static std::vector< AmendmentTable::FeatureInfomakeFeatureInfo (std::vector< std::string > const &amendments, VoteBehavior voteBehavior)
 
static std::vector< AmendmentTable::FeatureInfomakeDefaultYes (std::vector< std::string > const &amendments)
 
static std::vector< AmendmentTable::FeatureInfomakeDefaultYes (uint256 const amendment)
 
static std::vector< AmendmentTable::FeatureInfomakeDefaultNo (std::vector< std::string > const &amendments)
 
static std::vector< AmendmentTable::FeatureInfomakeObsolete (std::vector< std::string > const &amendments)
 
template<class Arg , class... Args>
static size_t totalsize (std::vector< Arg > const &src, Args const &... args)
 
template<class Arg , class... Args>
static void combine_arg (std::vector< Arg > &dest, std::vector< Arg > const &src, Args const &... args)
 
template<class Arg , class... Args>
static std::vector< Arg > combine (std::vector< Arg > left, std::vector< Arg > const &right, Args const &... args)
 

Private Attributes

const std::vector< std::stringyes_ {"g", "i", "k", "m", "o", "q", "r", "s", "t", "u"}
 
const std::vector< std::stringenabled_ {"b", "d", "f", "h", "j", "l", "n", "p"}
 
const std::vector< std::stringvetoed_ {"a", "c", "e"}
 
const std::vector< std::stringobsolete_ {"0", "1", "2"}
 
const std::vector< std::stringallSupported_
 
const std::vector< std::stringunsupported_ {"v", "w", "x"}
 
const std::vector< std::stringunsupportedMajority_ {"y", "z"}
 
const Section emptySection_
 
const std::vector< AmendmentTable::FeatureInfoemptyYes_
 
test::SuiteJournal journal_
 

Detailed Description

Definition at line 38 of file AmendmentTable_test.cpp.

Constructor & Destructor Documentation

◆ AmendmentTable_test()

ripple::AmendmentTable_test::AmendmentTable_test ( )

Definition at line 188 of file AmendmentTable_test.cpp.

Member Function Documentation

◆ amendmentId()

static uint256 ripple::AmendmentTable_test::amendmentId ( std::string  in)
staticprivate

Definition at line 42 of file AmendmentTable_test.cpp.

◆ makeSection() [1/3]

static Section ripple::AmendmentTable_test::makeSection ( std::string const &  name,
std::vector< std::string > const &  amendments 
)
staticprivate

Definition at line 54 of file AmendmentTable_test.cpp.

◆ makeSection() [2/3]

static Section ripple::AmendmentTable_test::makeSection ( std::vector< std::string > const &  amendments)
staticprivate

Definition at line 65 of file AmendmentTable_test.cpp.

◆ makeSection() [3/3]

static Section ripple::AmendmentTable_test::makeSection ( uint256 const &  amendment)
staticprivate

Definition at line 71 of file AmendmentTable_test.cpp.

◆ makeConfig()

std::unique_ptr<Config> ripple::AmendmentTable_test::makeConfig ( )
private

Definition at line 79 of file AmendmentTable_test.cpp.

◆ makeFeatureInfo()

static std::vector<AmendmentTable::FeatureInfo> ripple::AmendmentTable_test::makeFeatureInfo ( std::vector< std::string > const &  amendments,
VoteBehavior  voteBehavior 
)
staticprivate

Definition at line 90 of file AmendmentTable_test.cpp.

◆ makeDefaultYes() [1/2]

static std::vector<AmendmentTable::FeatureInfo> ripple::AmendmentTable_test::makeDefaultYes ( std::vector< std::string > const &  amendments)
staticprivate

Definition at line 104 of file AmendmentTable_test.cpp.

◆ makeDefaultYes() [2/2]

static std::vector<AmendmentTable::FeatureInfo> ripple::AmendmentTable_test::makeDefaultYes ( uint256 const  amendment)
staticprivate

Definition at line 110 of file AmendmentTable_test.cpp.

◆ makeDefaultNo()

static std::vector<AmendmentTable::FeatureInfo> ripple::AmendmentTable_test::makeDefaultNo ( std::vector< std::string > const &  amendments)
staticprivate

Definition at line 118 of file AmendmentTable_test.cpp.

◆ makeObsolete()

static std::vector<AmendmentTable::FeatureInfo> ripple::AmendmentTable_test::makeObsolete ( std::vector< std::string > const &  amendments)
staticprivate

Definition at line 124 of file AmendmentTable_test.cpp.

◆ totalsize()

template<class Arg , class... Args>
static size_t ripple::AmendmentTable_test::totalsize ( std::vector< Arg > const &  src,
Args const &...  args 
)
staticprivate

Definition at line 131 of file AmendmentTable_test.cpp.

◆ combine_arg()

template<class Arg , class... Args>
static void ripple::AmendmentTable_test::combine_arg ( std::vector< Arg > &  dest,
std::vector< Arg > const &  src,
Args const &...  args 
)
staticprivate

Definition at line 140 of file AmendmentTable_test.cpp.

◆ combine()

template<class Arg , class... Args>
static std::vector<Arg> ripple::AmendmentTable_test::combine ( std::vector< Arg >  left,
std::vector< Arg > const &  right,
Args const &...  args 
)
staticprivate

Definition at line 153 of file AmendmentTable_test.cpp.

◆ makeTable() [1/3]

std::unique_ptr<AmendmentTable> ripple::AmendmentTable_test::makeTable ( Application app,
std::chrono::seconds  majorityTime,
std::vector< AmendmentTable::FeatureInfo > const &  supported,
Section const &  enabled,
Section const &  vetoed 
)

Definition at line 193 of file AmendmentTable_test.cpp.

◆ makeTable() [2/3]

std::unique_ptr<AmendmentTable> ripple::AmendmentTable_test::makeTable ( test::jtx::Env env,
std::chrono::seconds  majorityTime,
std::vector< AmendmentTable::FeatureInfo > const &  supported,
Section const &  enabled,
Section const &  vetoed 
)

Definition at line 205 of file AmendmentTable_test.cpp.

◆ makeTable() [3/3]

std::unique_ptr<AmendmentTable> ripple::AmendmentTable_test::makeTable ( test::jtx::Env env,
std::chrono::seconds  majorityTime 
)

Definition at line 216 of file AmendmentTable_test.cpp.

◆ testConstruct()

void ripple::AmendmentTable_test::testConstruct ( )

Definition at line 237 of file AmendmentTable_test.cpp.

◆ testGet()

void ripple::AmendmentTable_test::testGet ( )

Definition at line 266 of file AmendmentTable_test.cpp.

◆ testBadConfig()

void ripple::AmendmentTable_test::testBadConfig ( )

Definition at line 305 of file AmendmentTable_test.cpp.

◆ testEnableVeto()

void ripple::AmendmentTable_test::testEnableVeto ( )

Definition at line 411 of file AmendmentTable_test.cpp.

◆ makeValidators()

std::vector<std::pair<PublicKey, SecretKey> > ripple::AmendmentTable_test::makeValidators ( int  num)

Definition at line 485 of file AmendmentTable_test.cpp.

◆ weekTime()

static NetClock::time_point ripple::AmendmentTable_test::weekTime ( weeks  w)
static

Definition at line 497 of file AmendmentTable_test.cpp.

◆ doRound()

void ripple::AmendmentTable_test::doRound ( uint256 const &  feat,
AmendmentTable table,
weeks  week,
std::vector< std::pair< PublicKey, SecretKey >> const &  validators,
std::vector< std::pair< uint256, int >> const &  votes,
std::vector< uint256 > &  ourVotes,
std::set< uint256 > &  enabled,
majorityAmendments_t majority 
)

Definition at line 504 of file AmendmentTable_test.cpp.

◆ testNoOnUnknown()

void ripple::AmendmentTable_test::testNoOnUnknown ( uint256 const &  feat)

Definition at line 603 of file AmendmentTable_test.cpp.

◆ testNoOnVetoed()

void ripple::AmendmentTable_test::testNoOnVetoed ( uint256 const &  feat)

Definition at line 665 of file AmendmentTable_test.cpp.

◆ testVoteEnable()

void ripple::AmendmentTable_test::testVoteEnable ( uint256 const &  feat)

Definition at line 730 of file AmendmentTable_test.cpp.

◆ testDetectMajority()

void ripple::AmendmentTable_test::testDetectMajority ( uint256 const &  feat)

Definition at line 809 of file AmendmentTable_test.cpp.

◆ testLostMajority()

void ripple::AmendmentTable_test::testLostMajority ( uint256 const &  feat)

Definition at line 878 of file AmendmentTable_test.cpp.

◆ testHasUnsupported()

void ripple::AmendmentTable_test::testHasUnsupported ( )

Definition at line 953 of file AmendmentTable_test.cpp.

◆ testFeature()

void ripple::AmendmentTable_test::testFeature ( uint256 const &  feat)

Definition at line 996 of file AmendmentTable_test.cpp.

◆ run()

void ripple::AmendmentTable_test::run ( )
override

Definition at line 1006 of file AmendmentTable_test.cpp.

Member Data Documentation

◆ yes_

const std::vector<std::string> ripple::AmendmentTable_test::yes_ {"g", "i", "k", "m", "o", "q", "r", "s", "t", "u"}
private

Definition at line 172 of file AmendmentTable_test.cpp.

◆ enabled_

const std::vector<std::string> ripple::AmendmentTable_test::enabled_ {"b", "d", "f", "h", "j", "l", "n", "p"}
private

Definition at line 174 of file AmendmentTable_test.cpp.

◆ vetoed_

const std::vector<std::string> ripple::AmendmentTable_test::vetoed_ {"a", "c", "e"}
private

Definition at line 175 of file AmendmentTable_test.cpp.

◆ obsolete_

const std::vector<std::string> ripple::AmendmentTable_test::obsolete_ {"0", "1", "2"}
private

Definition at line 176 of file AmendmentTable_test.cpp.

◆ allSupported_

const std::vector<std::string> ripple::AmendmentTable_test::allSupported_
private
Initial value:

Definition at line 177 of file AmendmentTable_test.cpp.

◆ unsupported_

const std::vector<std::string> ripple::AmendmentTable_test::unsupported_ {"v", "w", "x"}
private

Definition at line 179 of file AmendmentTable_test.cpp.

◆ unsupportedMajority_

const std::vector<std::string> ripple::AmendmentTable_test::unsupportedMajority_ {"y", "z"}
private

Definition at line 180 of file AmendmentTable_test.cpp.

◆ emptySection_

const Section ripple::AmendmentTable_test::emptySection_
private

Definition at line 182 of file AmendmentTable_test.cpp.

◆ emptyYes_

const std::vector<AmendmentTable::FeatureInfo> ripple::AmendmentTable_test::emptyYes_
private

Definition at line 183 of file AmendmentTable_test.cpp.

◆ journal_

test::SuiteJournal ripple::AmendmentTable_test::journal_
private

Definition at line 185 of file AmendmentTable_test.cpp.

ripple::AmendmentTable_test::yes_
const std::vector< std::string > yes_
Definition: AmendmentTable_test.cpp:172
ripple::AmendmentTable_test::vetoed_
const std::vector< std::string > vetoed_
Definition: AmendmentTable_test.cpp:175
ripple::AmendmentTable_test::obsolete_
const std::vector< std::string > obsolete_
Definition: AmendmentTable_test.cpp:176
ripple::AmendmentTable_test::combine
static std::vector< Arg > combine(std::vector< Arg > left, std::vector< Arg > const &right, Args const &... args)
Definition: AmendmentTable_test.cpp:153
ripple::AmendmentTable_test::enabled_
const std::vector< std::string > enabled_
Definition: AmendmentTable_test.cpp:174