mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 09:50:08 +01:00
2eef3720a9
This commit contains the entire btcwire repository along with several changes needed to move all of the files into the wire directory in order to prepare it for merging. This does NOT update btcd or any of the other packages to use the new location as that will be done separately. - All import paths in the old btcwire test files have been changed to the new location - All references to btcwire as the package name have been chagned to wire - The coveralls badge has been removed since it unfortunately doesn't support coverage of sub-packages This is ongoing work toward #214.
58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
// Copyright (c) 2013-2015 Conformal Systems LLC.
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package wire_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcd/wire"
|
|
)
|
|
|
|
// TestServiceFlagStringer tests the stringized output for service flag types.
|
|
func TestServiceFlagStringer(t *testing.T) {
|
|
tests := []struct {
|
|
in wire.ServiceFlag
|
|
want string
|
|
}{
|
|
{0, "0x0"},
|
|
{wire.SFNodeNetwork, "SFNodeNetwork"},
|
|
{0xffffffff, "SFNodeNetwork|0xfffffffe"},
|
|
}
|
|
|
|
t.Logf("Running %d tests", len(tests))
|
|
for i, test := range tests {
|
|
result := test.in.String()
|
|
if result != test.want {
|
|
t.Errorf("String #%d\n got: %s want: %s", i, result,
|
|
test.want)
|
|
continue
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestBitcoinNetStringer tests the stringized output for bitcoin net types.
|
|
func TestBitcoinNetStringer(t *testing.T) {
|
|
tests := []struct {
|
|
in wire.BitcoinNet
|
|
want string
|
|
}{
|
|
{wire.MainNet, "MainNet"},
|
|
{wire.TestNet, "TestNet"},
|
|
{wire.TestNet3, "TestNet3"},
|
|
{wire.SimNet, "SimNet"},
|
|
{0xffffffff, "Unknown BitcoinNet (4294967295)"},
|
|
}
|
|
|
|
t.Logf("Running %d tests", len(tests))
|
|
for i, test := range tests {
|
|
result := test.in.String()
|
|
if result != test.want {
|
|
t.Errorf("String #%d\n got: %s want: %s", i, result,
|
|
test.want)
|
|
continue
|
|
}
|
|
}
|
|
}
|