github.com/turingchain2020/turingchain@v1.1.21/blockchain/blockchain_test.go (about) 1 // Copyright Turing Corp. 2018 All Rights Reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package blockchain 6 7 import ( 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 ) 12 13 func TestCalcHeightToBlockHeaderKey(t *testing.T) { 14 key := calcHeightToBlockHeaderKey(1) 15 assert.Equal(t, key, []byte("HH:000000000001")) 16 key = calcHeightToBlockHeaderKey(0) 17 assert.Equal(t, key, []byte("HH:000000000000")) 18 key = calcHeightToBlockHeaderKey(10) 19 assert.Equal(t, key, []byte("HH:000000000010")) 20 }