forked from 0xakk0r0kamui/constant-chain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver_test.go
37 lines (35 loc) · 1021 Bytes
/
server_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"github.com/incognitochain/incognito-chain/blockchain"
"github.com/incognitochain/incognito-chain/peer"
"github.com/incognitochain/incognito-chain/wire"
"testing"
)
func TestServer_OnFinishSync(t *testing.T) {
type fields struct {
blockChain *blockchain.BlockChain
}
type args struct {
p *peer.PeerConn
msg *wire.MessageFinishSync
}
tests := []struct {
name string
fields fields
args args
}{
//TODO: @hung add testcase
// Testcase 1: beaconBestState.SyncValidator > 0, finish sync validator = 0
// Testcase 2: beaconBestState.SyncValidator = 0, finish sync validator > 0
// Testcase 3: beaconBestState.SyncValidator > 0, finish sync validator > 0, but no 100% identical
// Testcase 4: beaconBestState.SyncValidator > 0, finish sync validator > 0, 100% identical
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
serverObj := &Server{
blockChain: tt.fields.blockChain,
}
serverObj.OnFinishSync(tt.args.p, tt.args.msg)
})
}
}