github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/protos/common/ledger_test.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package common 8 9 import ( 10 "testing" 11 12 "github.com/stretchr/testify/assert" 13 ) 14 15 func TestLedger(t *testing.T) { 16 var info *BlockchainInfo 17 info = nil 18 assert.Equal(t, uint64(0), info.GetHeight()) 19 assert.Nil(t, info.GetCurrentBlockHash()) 20 assert.Nil(t, info.GetPreviousBlockHash()) 21 info = &BlockchainInfo{ 22 Height: uint64(1), 23 CurrentBlockHash: []byte("blockhash"), 24 PreviousBlockHash: []byte("previoushash"), 25 } 26 assert.Equal(t, uint64(1), info.GetHeight()) 27 assert.NotNil(t, info.GetCurrentBlockHash()) 28 assert.NotNil(t, info.GetPreviousBlockHash()) 29 info.Reset() 30 assert.Equal(t, uint64(0), info.GetHeight()) 31 _ = info.String() 32 _, _ = info.Descriptor() 33 info.ProtoMessage() 34 }