Skip to content

Commit

Permalink
Add test case in core/util/utils_test.go
Browse files Browse the repository at this point in the history
Added a test case to pass through all of the function.
But not 100% coverrage.

Change-Id: I0fc47568e42409a0a6db0dff3417fb5a38ae3618
Signed-off-by: Nao Nishijima <nao.nishijima@hal.hitachi.com>
  • Loading branch information
Nao Nishijima committed Aug 6, 2016
1 parent 8002995 commit c0d2c8d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/util/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ func TestGenerateHashFromSignature(t *testing.T) {
}
}

func TestGenerateUUIDfromTxSHAHash(t *testing.T) {
uuid := GenerateUUIDfromTxSHAHash([]byte("foobar"))
if len(uuid) != 36 {
t.Fatalf("UUID length is not correct. Expected = 36, Got = %d", len(uuid))
}
uuid2 := GenerateUUIDfromTxSHAHash([]byte("foobar1"))
if uuid == uuid2 {
t.Fatalf("Two UUIDs are equal. This should never occur")
}
}

func TestGenerateIDWithAlg(t *testing.T) {
_, err := GenerateIDWithAlg("sha256base64", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
if err != nil {
t.Fatalf("Decoder failure: %v", err)
}
}

func TestFindMissingElements(t *testing.T) {
all := []string{"a", "b", "c", "d"}
some := []string{"b", "c"}
Expand Down

0 comments on commit c0d2c8d

Please sign in to comment.