1// Copyright (c) 2015 The btcsuite developers 2// Use of this source code is governed by an ISC 3// license that can be found in the LICENSE file. 4 5package blockchain 6 7import ( 8 "testing" 9 10 "github.com/btcsuite/btcutil" 11) 12 13// BenchmarkIsCoinBase performs a simple benchmark against the IsCoinBase 14// function. 15func BenchmarkIsCoinBase(b *testing.B) { 16 tx, _ := btcutil.NewBlock(&Block100000).Tx(1) 17 b.ResetTimer() 18 for i := 0; i < b.N; i++ { 19 IsCoinBase(tx) 20 } 21} 22 23// BenchmarkIsCoinBaseTx performs a simple benchmark against the IsCoinBaseTx 24// function. 25func BenchmarkIsCoinBaseTx(b *testing.B) { 26 tx := Block100000.Transactions[1] 27 b.ResetTimer() 28 for i := 0; i < b.N; i++ { 29 IsCoinBaseTx(tx) 30 } 31} 32