github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/consensus/tribe/status_test.go (about) 1 package tribe 2 3 import ( 4 "github.com/SmartMeshFoundation/Spectrum/common" 5 "testing" 6 ) 7 8 var ( 9 address1 = common.HexToAddress("0x4110bd1ff0b73fa12c259acf39c950277f266787") 10 address2 = common.HexToAddress("0xadb3ea3ad356199206ca817b04fd668cc5196df2") 11 address3 = common.HexToAddress("0xb94b3aa41609e3f59cbaff3c2c298c6cc4c50b81") 12 13 signerList1 = []*Signer{{address1, 2}} 14 signerList2 = []*Signer{{address2, 2}, {address3, 2}} 15 signerList3 = []*Signer{{address1, 3}, {address2, 3}, {address3, 3}} 16 17 tribe = &TribeStatus{ 18 Signers: signerList3, 19 } 20 ) 21 22 type BUF []byte 23 24 func (a BUF) Str() string { return string(a[:]) } 25 func TestSigners(t *testing.T) { 26 27 } 28 29 func TestMinerSigner(t *testing.T) { 30 miner := "0x4110bd1ff0b73fa12c259acf39c950277f266787" 31 miner2 := "0x4110bd1ff0b73fa12c259acf39c950277f266787" 32 add := common.HexToAddress(miner) 33 add2 := common.HexToAddress(miner2) 34 35 t.Log(add) 36 t.Log(add == add2) 37 } 38 39 func TestAddr(t *testing.T) { 40 var addr common.Address 41 t.Log(common.HexToAddress("0x") == addr) 42 t.Log(common.HexToAddress("0x") == common.HexToAddress("")) 43 } 44 45 func TestLeaderSort(t *testing.T) { 46 f := common.HexToAddress("0x3") 47 list := []common.Address{ 48 common.HexToAddress("0x1"), 49 common.HexToAddress("0x2"), 50 common.HexToAddress("0x3"), 51 common.HexToAddress("0x4"), 52 common.HexToAddress("0x5"), 53 } 54 r, err := leaderSort(f, list) 55 t.Log(err) 56 t.Log(list) 57 t.Log(r) 58 }