md5_test.go 565 B

1234567891011121314151617181920212223
  1. package cryptoutil
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestMD5(t *testing.T) {
  7. tests := []struct {
  8. input string
  9. output string
  10. }{
  11. {input: "", output: "d41d8cd98f00b204e9800998ecf8427e"},
  12. {input: "The quick brown fox jumps over the lazy dog", output: "9e107d9d372bb6826bd81d3542a419d6"},
  13. {input: "The quick brown fox jumps over the lazy dog.", output: "e4d909c290d0fb1ca068ffaddf22cbd0"},
  14. }
  15. for _, test := range tests {
  16. t.Run(test.input, func(t *testing.T) {
  17. assert.Equal(t, test.output, MD5(test.input))
  18. })
  19. }
  20. }