going somewhere

This commit is contained in:
didier amyot committed 2014-11-09 18:28:08 -08:00
1 parent 6b3c99664c
commit 209af0d820
16 files changed
+549 -131

No files matched your search

+22
View File
@@ -1,6 +1,7 @@
package helper
import (
"crypto"
"errors"
"testing"
)
@@ -36,3 +37,24 @@ func TestJoinErrors(t *testing.T) {
t.Error("bad error")
}
}
func TestGetHashFunctionByLowerCaseName(t *testing.T) {
m := map[string]crypto.Hash{
"md4": crypto.MD4,
"md5": crypto.MD5,
"sha1": crypto.SHA1,
"sha224": crypto.SHA224,
"sha256": crypto.SHA256,
"sha384": crypto.SHA384,
"sha512": crypto.SHA512,
"md5sha1": crypto.MD5SHA1,
"ripemd160": crypto.RIPEMD160,
}
for hashName, exptedHash := range m {
if hash, err := GetHashFunctionByLowerCaseName(hashName); err != nil {
t.Error(err)
} else if hash != exptedHash {
t.Error("bad hash found for ", hashName)
}
}
}