Electroneum
checkpoints.cpp File Reference
#include "gtest/gtest.h"
#include "checkpoints/checkpoints.cpp"
Include dependency graph for checkpoints.cpp:

Go to the source code of this file.

Functions

 TEST (checkpoints_is_alternative_block_allowed, handles_empty_checkpoints)
 
 TEST (checkpoints_is_alternative_block_allowed, handles_one_checkpoint)
 
 TEST (checkpoints_is_alternative_block_allowed, handles_two_and_more_checkpoints)
 

Function Documentation

◆ TEST() [1/3]

TEST ( checkpoints_is_alternative_block_allowed  ,
handles_empty_checkpoints   
)

Definition at line 39 of file checkpoints.cpp.

40 {
41  checkpoints cp;
42 
44 
48 }
bool is_alternative_block_allowed(uint64_t blockchain_height, uint64_t block_height) const
checks if alternate chain blocks should be kept for a given height
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
A container for blockchain checkpoints.
Definition: checkpoints.h:51
Here is the call graph for this function:

◆ TEST() [2/3]

TEST ( checkpoints_is_alternative_block_allowed  ,
handles_one_checkpoint   
)

Definition at line 50 of file checkpoints.cpp.

51 {
52  checkpoints cp;
53  ASSERT_TRUE(cp.add_checkpoint(5, "0000000000000000000000000000000000000000000000000000000000000000"));
54 
56 
62 
68 
74 
80 
86 }
bool add_checkpoint(uint64_t height, const std::string &hash_str)
adds a checkpoint to the container
Definition: checkpoints.cpp:76
bool is_alternative_block_allowed(uint64_t blockchain_height, uint64_t block_height) const
checks if alternate chain blocks should be kept for a given height
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
A container for blockchain checkpoints.
Definition: checkpoints.h:51
Here is the call graph for this function:

◆ TEST() [3/3]

TEST ( checkpoints_is_alternative_block_allowed  ,
handles_two_and_more_checkpoints   
)

Definition at line 88 of file checkpoints.cpp.

89 {
90  checkpoints cp;
91  ASSERT_TRUE(cp.add_checkpoint(5, "0000000000000000000000000000000000000000000000000000000000000000"));
92  ASSERT_TRUE(cp.add_checkpoint(9, "0000000000000000000000000000000000000000000000000000000000000000"));
93 
95 
104 
113 
122 
131 
140 
149 
158 
167 }
bool add_checkpoint(uint64_t height, const std::string &hash_str)
adds a checkpoint to the container
Definition: checkpoints.cpp:76
bool is_alternative_block_allowed(uint64_t blockchain_height, uint64_t block_height) const
checks if alternate chain blocks should be kept for a given height
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
A container for blockchain checkpoints.
Definition: checkpoints.h:51
Here is the call graph for this function: