2
0

md5_test.go 727 B

123456789101112131415161718192021222324252627
  1. // Copyright 2020 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package cryptoutil
  5. import (
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func TestMD5(t *testing.T) {
  10. tests := []struct {
  11. input string
  12. output string
  13. }{
  14. {input: "", output: "d41d8cd98f00b204e9800998ecf8427e"},
  15. {input: "The quick brown fox jumps over the lazy dog", output: "9e107d9d372bb6826bd81d3542a419d6"},
  16. {input: "The quick brown fox jumps over the lazy dog.", output: "e4d909c290d0fb1ca068ffaddf22cbd0"},
  17. }
  18. for _, test := range tests {
  19. t.Run(test.input, func(t *testing.T) {
  20. assert.Equal(t, test.output, MD5(test.input))
  21. })
  22. }
  23. }