1 // Copyright (c) 2016 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
9 // TestInvalidHashStr ensures the newShaHashFromStr function panics when used to
10 // with an invalid hash string.
11 func TestInvalidHashStr(t *testing.T) {
13 if r := recover(); r == nil {
14 t.Errorf("Expected panic for invalid hash, got nil")
17 newHashFromStr("banana")
20 // TestMustRegisterPanic ensures the mustRegister function panics when used to
21 // register an invalid network.
22 func TestMustRegisterPanic(t *testing.T) {
25 // Setup a defer to catch the expected panic to ensure it actually
28 if err := recover(); err == nil {
29 t.Error("mustRegister did not panic as expected")
33 // Intentionally try to register duplicate params to force a panic.
34 mustRegister(&MainNetParams)