mirror of
https://github.com/guggero/chantools
synced 2024-11-15 06:12:49 +00:00
28 lines
549 B
Go
28 lines
549 B
Go
|
package btc
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
var testCases = []struct {
|
||
|
descriptor string
|
||
|
expectedSum string
|
||
|
}{{
|
||
|
descriptor: "addr(mkmZxiEcEd8ZqjQWVZuC6so5dFMKEFpN2j)",
|
||
|
expectedSum: "#02wpgw69",
|
||
|
}, {
|
||
|
descriptor: "tr(cRhCT5vC5NdnSrQ2Jrah6NPCcth41uT8DWFmA6uD8R4x2ufucnYX)",
|
||
|
expectedSum: "#gwfmkgga",
|
||
|
}}
|
||
|
|
||
|
func TestDescriptorSum(t *testing.T) {
|
||
|
for _, tc := range testCases {
|
||
|
sum := DescriptorSumCreate(tc.descriptor)
|
||
|
require.Equal(t, tc.descriptor+tc.expectedSum, sum)
|
||
|
|
||
|
DescriptorSumCheck(sum, true)
|
||
|
}
|
||
|
}
|