From 6d95559bf7eb62e6c114ca4d4040c44ffd553629 Mon Sep 17 00:00:00 2001 From: Mission Liao Date: Tue, 20 Nov 2018 13:57:24 +0800 Subject: core: support NumChains change for BA modules (#339) --- core/lattice-data_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'core/lattice-data_test.go') 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() { -- cgit v1.2.3