Files
filou/payload/payload_test.go
T
2014-10-14 06:31:36 -07:00

28 lines
700 B
Go

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)
}
}
}