1 // Copyright (c) 2014 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
11 "github.com/btcsuite/btcd/btcjson"
14 // TestHelpers tests the various helper functions which create pointers to
16 func TestHelpers(t *testing.T) {
26 f: func() interface{} {
27 return btcjson.Bool(true)
29 expected: func() interface{} {
36 f: func() interface{} {
39 expected: func() interface{} {
46 f: func() interface{} {
47 return btcjson.Uint(5)
49 expected: func() interface{} {
56 f: func() interface{} {
57 return btcjson.Int32(5)
59 expected: func() interface{} {
66 f: func() interface{} {
67 return btcjson.Uint32(5)
69 expected: func() interface{} {
76 f: func() interface{} {
77 return btcjson.Int64(5)
79 expected: func() interface{} {
86 f: func() interface{} {
87 return btcjson.Uint64(5)
89 expected: func() interface{} {
96 f: func() interface{} {
97 return btcjson.String("abc")
99 expected: func() interface{} {
106 t.Logf("Running %d tests", len(tests))
107 for i, test := range tests {
109 if !reflect.DeepEqual(result, test.expected) {
110 t.Errorf("Test #%d (%s) unexpected value - got %v, "+
111 "want %v", i, test.name, result, test.expected)