You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
512 B
24 lines
512 B
package cos
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func Test_calSHA1Digest(t *testing.T) {
|
|
want := "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
|
|
got := fmt.Sprintf("%x", calSHA1Digest([]byte("test")))
|
|
if got != want {
|
|
|
|
t.Errorf("calSHA1Digest request sha1: %+v, want %+v", got, want)
|
|
}
|
|
}
|
|
|
|
func Test_calMD5Digest(t *testing.T) {
|
|
want := "098f6bcd4621d373cade4e832627b4f6"
|
|
got := fmt.Sprintf("%x", calMD5Digest([]byte("test")))
|
|
if got != want {
|
|
|
|
t.Errorf("calMD5Digest request md5: %+v, want %+v", got, want)
|
|
}
|
|
}
|