Skip to content

Commit

Permalink
Fix unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
weiribao committed Dec 10, 2019
1 parent d0045fc commit 29afe08
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions consensus/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ func TestSingleBlockValidation(t *testing.T) {
require.Equal("Invalid proposer", res.Message)
}

/*
func TestValidParent(t *testing.T) {
require := require.New(t)

Expand Down Expand Up @@ -265,6 +264,7 @@ func TestValidParent(t *testing.T) {
eb2, err := chain.AddBlock(b2)
require.Nil(err)

eb1 = chain.MarkBlockInvalid(eb1.Hash())
res := ce.validateBlock(b2, eb1)
require.True(res.IsError(), "Parent block is invalid")
require.Equal("Parent block is invalid", res.Message)
Expand Down Expand Up @@ -296,7 +296,6 @@ func TestValidParent(t *testing.T) {
res = ce.validateBlock(b3, eb2)
require.True(res.IsOK(), "HCC is valid")
}
*/

func TestChildBlockOfValidatorChange(t *testing.T) {
require := require.New(t)
Expand Down
2 changes: 1 addition & 1 deletion crypto/bn256/google/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestRandomG2Marshal(t *testing.T) {
t.Error(err)
continue
}
t.Logf("%d: %x\n", n, g2.Marshal())
t.Logf("%v: %x\n", n, g2.Marshal())
}
}

Expand Down
13 changes: 11 additions & 2 deletions netsync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ package netsync
import (
"context"
"testing"
"time"

"github.com/thetatoken/theta/consensus"
"github.com/thetatoken/theta/rlp"
"github.com/thetatoken/theta/store/database/backend"
"github.com/thetatoken/theta/store/kvstore"

"github.com/thetatoken/theta/core"
"github.com/thetatoken/theta/crypto"
Expand Down Expand Up @@ -52,7 +58,6 @@ func (m *MockMsgHandler) HandleMessage(message types.Message) error {
return nil
}

/*
func TestSyncManager(t *testing.T) {
assert := assert.New(t)
core.ResetTestBlocks()
Expand Down Expand Up @@ -104,6 +109,11 @@ func TestSyncManager(t *testing.T) {
assert.Equal(common.ChannelIDBlock, msg1.ChannelID)
assert.Equal(core.GetTestBlock("A4").Hash().Hex(), msg1.Entries[0])

res = <-mockMsgHandler.C
msg11, ok := res.(dispatcher.DataResponse)
assert.True(ok)
assert.Equal(common.ChannelIDHeader, msg11.ChannelID)

res = <-mockMsgHandler.C
msg2, ok := res.(dispatcher.InventoryRequest)
assert.True(ok)
Expand Down Expand Up @@ -160,7 +170,6 @@ func TestSyncManager(t *testing.T) {
assert.Equal(core.GetTestBlock(expected[i]).Hash(), msg.(*core.Block).Hash())
}
}
*/

type MockConsensus struct {
chain *blockchain.Chain
Expand Down

0 comments on commit 29afe08

Please sign in to comment.