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

  1. package cos
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func Test_calSHA1Digest(t *testing.T) {
  7. want := "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
  8. got := fmt.Sprintf("%x", calSHA1Digest([]byte("test")))
  9. if got != want {
  10. t.Errorf("calSHA1Digest request sha1: %+v, want %+v", got, want)
  11. }
  12. }
  13. func Test_calMD5Digest(t *testing.T) {
  14. want := "098f6bcd4621d373cade4e832627b4f6"
  15. got := fmt.Sprintf("%x", calMD5Digest([]byte("test")))
  16. if got != want {
  17. t.Errorf("calMD5Digest request md5: %+v, want %+v", got, want)
  18. }
  19. }