7#include <test/util/random.h>
8#include <test/util/setup_common.h>
10#include <boost/test/unit_test.hpp>
28#define REGISTER_VOTE_AND_CHECK(vr, vote, state, finalized, stale, confidence) \
29 vr.registerVote(nextNodeId(), vote); \
30 BOOST_CHECK_EQUAL(vr.isAccepted(), state); \
31 BOOST_CHECK_EQUAL(vr.hasFinalized(), finalized); \
32 BOOST_CHECK_EQUAL(vr.isStale(), stale); \
33 BOOST_CHECK_EQUAL(vr.getConfidence(), confidence);
53 for (
int i = 0; i < 6; i++) {
63 for (
int i = 2; i < 8; i++) {
70 for (
int i = 2; i < 8; i++) {
84 for (
int i = 0; i < 5; i++) {
95 for (
int i = 2; i < 8; i++) {
102 for (
int i = 2; i < 8; i++) {
129 for (
int j = 1;
j < i;
j++) {
147 for (
auto j = 0;
j < 6;
j++) {
168 for (
auto i = 0; i < 5; i++) {
173 for (
uint32_t i = 0; i < confidence; i++) {
182 if (confidence == 1) {
216 vr.registerVote(nextNodeId(), 0);
219 vr.registerVote(nextNodeId(), 1);
247 for (
auto i = 0; i <
offset; i++) {
253 for (
auto i = 0; i < 5; i++) {
287 for (
auto i = 0; i < 6; i++) {
316 for (
auto i = 0; i < 7; i++) {
323 for (
auto i = 0; i < 8; i++) {
331 for (
auto i = 0; i < 8; i++) {
334 for (
auto j = i;
j < 8;
j++) {
341 for (
auto i = 0; i < 90; i++) {
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static constexpr uint32_t AVALANCHE_VOTE_STALE_FACTOR
Scaling factor applied to confidence to determine staleness threshold.
static constexpr int AVALANCHE_MAX_INFLIGHT_POLL
How many inflight requests can exist for one item.
static constexpr uint32_t AVALANCHE_VOTE_STALE_THRESHOLD
Number of votes before a record may be considered as stale.
static constexpr int AVALANCHE_FINALIZATION_SCORE
Finalization score.
#define REGISTER_VOTE_AND_CHECK(vr, vote, state, finalized, stale, confidence)
BOOST_AUTO_TEST_CASE(vote_record)