mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-31 19:26:42 +00:00

* [DEV-17] Moved Bech32 stuff from params.go to address.go. * [DEV-17] Removed dagconfig dependency from address_test.go. * [DEV-17] Removed dagconfig dependency from builder_test.go. * [DEV-17] Removed dagconfig dependency from internal_test.go. * [DEV-17] Removed dagconfig dependency from wif.go. * [DEV-17] Removed dagconfig dependency from externdedkey.go. * [DEV-17] Fixed compilation errors outside of hdkeychain. * [DEV-17] Resolved circular dependencies. * [DEV-17] Fixed failing tests. * [DEV-17] Renamed DagXxx to Bech32PrefixDAGXxx * [DEV-17] Fixed register_test.go. * [DEV-17] Renamed HDKeyIDPairXxxNet to XxxNetHDKeyPair. * [DEV-17] Renamed IsForNet to IsForPrefix.
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
// Copyright (c) 2016 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package dagconfig
|
|
|
|
import "testing"
|
|
|
|
// TestInvalidHashStr ensures the newShaHashFromStr function panics when used to
|
|
// with an invalid hash string.
|
|
func TestInvalidHashStr(t *testing.T) {
|
|
defer func() {
|
|
if r := recover(); r == nil {
|
|
t.Errorf("Expected panic for invalid hash, got nil")
|
|
}
|
|
}()
|
|
newHashFromStr("banana")
|
|
}
|
|
|
|
// TestMustRegisterPanic ensures the mustRegister function panics when used to
|
|
// register an invalid network.
|
|
func TestMustRegisterPanic(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
// Setup a defer to catch the expected panic to ensure it actually
|
|
// paniced.
|
|
defer func() {
|
|
if err := recover(); err == nil {
|
|
t.Error("mustRegister did not panic as expected")
|
|
}
|
|
}()
|
|
|
|
// Intentionally try to register duplicate params to force a panic.
|
|
mustRegister(&MainNetParams)
|
|
}
|
|
|
|
func TestDNSSeedToString(t *testing.T) {
|
|
host := "test.dns.seed.com"
|
|
seed := DNSSeed{HasFiltering: false, Host: host}
|
|
|
|
result := seed.String()
|
|
if result != host {
|
|
t.Errorf("TestDNSSeedToString: Expected: %s, but got: %s", host, result)
|
|
}
|
|
}
|