diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-11-20 13:57:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20 13:57:24 +0800 |
commit | 6d95559bf7eb62e6c114ca4d4040c44ffd553629 (patch) | |
tree | 5c62252e4cfe59c318ef3bb67b6c55891a58a4d3 /core/lattice-data_test.go | |
parent | e5891f7ca08737c3f3bc37fd523537cb243f8b0d (diff) | |
download | dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.tar dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.tar.gz dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.tar.bz2 dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.tar.lz dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.tar.xz dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.tar.zst dexon-consensus-6d95559bf7eb62e6c114ca4d4040c44ffd553629.zip |
core: support NumChains change for BA modules (#339)
Diffstat (limited to 'core/lattice-data_test.go')
-rw-r--r-- | core/lattice-data_test.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/lattice-data_test.go b/core/lattice-data_test.go index 24f45e6..e939c81 100644 --- a/core/lattice-data_test.go +++ b/core/lattice-data_test.go @@ -550,11 +550,13 @@ func (s *LatticeDataTestSuite) TestPrepareBlock() { req.Equal(b01.Position.Height, uint64(1)) } -func (s *LatticeDataTestSuite) TestNextPosition() { - // Test 'NextPosition' method when lattice is ready. +func (s *LatticeDataTestSuite) TestNextHeight() { + // Test 'NextHeight' method when lattice is ready. data, _ := s.genTestCase1() - s.Equal(data.nextPosition(0), types.Position{ChainID: 0, Height: 4}) - // Test 'NextPosition' method when lattice is empty. + h, err := data.nextHeight(0, 0) + s.Require().NoError(err) + s.Require().Equal(h, uint64(4)) + // Test 'NextHeight' method when lattice is empty. // Setup a configuration that no restriction on block interval and // round cutting. genesisConfig := &types.Config{ @@ -563,7 +565,9 @@ func (s *LatticeDataTestSuite) TestNextPosition() { MinBlockInterval: 1 * time.Second, } data = newLatticeData(nil, time.Now().UTC(), 0, genesisConfig) - s.Equal(data.nextPosition(0), types.Position{ChainID: 0, Height: 0}) + h, err = data.nextHeight(0, 0) + s.Require().NoError(err) + s.Require().Equal(h, uint64(0)) } func (s *LatticeDataTestSuite) TestPrepareEmptyBlock() { |