Skip to content

Commit c0d2c8d

Browse files
author
Nao Nishijima
committed
Add test case in core/util/utils_test.go
Added a test case to pass through all of the function. But not 100% coverrage. Change-Id: I0fc47568e42409a0a6db0dff3417fb5a38ae3618 Signed-off-by: Nao Nishijima <[email protected]>
1 parent 8002995 commit c0d2c8d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

core/util/utils_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ func TestGenerateHashFromSignature(t *testing.T) {
6969
}
7070
}
7171

72+
func TestGenerateUUIDfromTxSHAHash(t *testing.T) {
73+
uuid := GenerateUUIDfromTxSHAHash([]byte("foobar"))
74+
if len(uuid) != 36 {
75+
t.Fatalf("UUID length is not correct. Expected = 36, Got = %d", len(uuid))
76+
}
77+
uuid2 := GenerateUUIDfromTxSHAHash([]byte("foobar1"))
78+
if uuid == uuid2 {
79+
t.Fatalf("Two UUIDs are equal. This should never occur")
80+
}
81+
}
82+
83+
func TestGenerateIDWithAlg(t *testing.T) {
84+
_, err := GenerateIDWithAlg("sha256base64", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
85+
if err != nil {
86+
t.Fatalf("Decoder failure: %v", err)
87+
}
88+
}
89+
7290
func TestFindMissingElements(t *testing.T) {
7391
all := []string{"a", "b", "c", "d"}
7492
some := []string{"b", "c"}

0 commit comments

Comments
 (0)