small refactor
This commit is contained in:
parent
92e35bd23a
commit
dd284f117f
3 changed files with 15 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
||||||
package util
|
package lbrycrd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
|
@ -1,17 +1,16 @@
|
||||||
package util
|
package lbrycrd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/lbryio/lbry.go/lbrycrd"
|
||||||
)
|
)
|
||||||
|
|
||||||
type claimIdMatch struct {
|
var claimIdTests = []struct {
|
||||||
ClaimId string
|
claimID string
|
||||||
TxHash string
|
txHash string
|
||||||
N uint
|
n int
|
||||||
}
|
}{
|
||||||
|
|
||||||
var claimIdTests = []claimIdMatch{
|
|
||||||
|
|
||||||
{"589bc4845caca70977332025990b2a1807732b44",
|
{"589bc4845caca70977332025990b2a1807732b44",
|
||||||
"6a9dbe3084b86cec8aa519970d2245dfa15193294cab65819a0d96d455c2a5df",
|
"6a9dbe3084b86cec8aa519970d2245dfa15193294cab65819a0d96d455c2a5df",
|
||||||
1},
|
1},
|
||||||
|
@ -43,15 +42,13 @@ var claimIdTests = []claimIdMatch{
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetClaimIDFromOutput(t *testing.T) {
|
func TestGetClaimIDFromOutput(t *testing.T) {
|
||||||
|
for _, test := range claimIdTests {
|
||||||
for _, claimMatch := range claimIdTests {
|
claimID, err := lbrycrd.ClaimIDFromOutpoint(test.txHash, test.n)
|
||||||
claimID, err := ClaimIDFromOutpoint(claimMatch.TxHash, int(claimMatch.N))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Errorf("%s: %v", test.claimID, err)
|
||||||
}
|
}
|
||||||
if claimID != claimMatch.ClaimId {
|
if test.claimID != claimID {
|
||||||
t.Error("Expected ", claimMatch.ClaimId, " got ", claimID)
|
t.Errorf("expected %s, got %s", test.claimID, claimID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package querytools
|
package query
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
Loading…
Reference in a new issue