add all
This commit is contained in:
1 parent
4897e8d307
commit
4aca3324c9
10 files changed
+401
-17
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package payload
|
||||
|
||||
import (
|
||||
"crypto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPayloadGetHashMethod(t *testing.T) {
|
||||
p := new(Payload)
|
||||
testCases := make(map[string]crypto.Hash)
|
||||
testCases["md4"] = crypto.MD4
|
||||
testCases["md5"] = crypto.MD5
|
||||
testCases["sha1"] = crypto.SHA1
|
||||
testCases["sha224"] = crypto.SHA224
|
||||
testCases["sha256"] = crypto.SHA256
|
||||
testCases["sha384"] = crypto.SHA384
|
||||
testCases["sha512"] = crypto.SHA512
|
||||
testCases["md5sha1"] = crypto.MD5SHA1
|
||||
testCases["ripemd160"] = crypto.RIPEMD160
|
||||
for name, hashfunc := range testCases {
|
||||
p.Hash = hashfunc
|
||||
if returnedName := p.GetHashMethod(); returnedName != name {
|
||||
t.Error("bad hash name. supposed to be ", name, " but received", returnedName)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user