aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/block_test.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-09-03 10:01:40 +0800
committerGitHub <noreply@github.com>2018-09-03 10:01:40 +0800
commitc8d3092208f73ee991a123052a71b7dbf7fffc27 (patch)
treefdcb3b90b859531e042dbbdd6bcd7b0cca40e86a /core/types/block_test.go
parent9491ddae81640e04f8aed38e2cddeb64cc62d55b (diff)
downloaddexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar
dexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.gz
dexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.bz2
dexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.lz
dexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.xz
dexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.zst
dexon-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.zip
core: Add a new structure `Position` and move `ShardID`, `ChainID` and `Height` from `Block` (#89)
Diffstat (limited to 'core/types/block_test.go')
-rw-r--r--core/types/block_test.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/core/types/block_test.go b/core/types/block_test.go
index 2087373..4763ad1 100644
--- a/core/types/block_test.go
+++ b/core/types/block_test.go
@@ -49,10 +49,10 @@ func (s *BlockTestSuite) TestSortByHash() {
}
func (s *BlockTestSuite) TestSortByHeight() {
- b0 := &Block{Height: 0}
- b1 := &Block{Height: 1}
- b2 := &Block{Height: 2}
- b3 := &Block{Height: 3}
+ b0 := &Block{Position: Position{Height: 0}}
+ b1 := &Block{Position: Position{Height: 1}}
+ b2 := &Block{Position: Position{Height: 2}}
+ b3 := &Block{Position: Position{Height: 3}}
blocks := []*Block{b3, b2, b1, b0}
sort.Sort(ByHeight(blocks))
@@ -64,17 +64,23 @@ func (s *BlockTestSuite) TestSortByHeight() {
func (s *BlockTestSuite) TestGenesisBlock() {
b0 := &Block{
- Height: 0,
+ Position: Position{
+ Height: 0,
+ },
ParentHash: common.Hash{},
}
s.True(b0.IsGenesis())
b1 := &Block{
- Height: 1,
+ Position: Position{
+ Height: 1,
+ },
ParentHash: common.Hash{},
}
s.False(b1.IsGenesis())
b2 := &Block{
- Height: 0,
+ Position: Position{
+ Height: 0,
+ },
ParentHash: common.NewRandomHash(),
}
s.False(b2.IsGenesis())