2015-03-06 04:50:51 -05:00
|
|
|
package md5_test
|
2014-12-20 19:01:27 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"encoding/hex"
|
|
|
|
"testing"
|
|
|
|
|
2015-05-11 19:23:10 -04:00
|
|
|
. "github.com/minio/check"
|
2015-07-03 18:17:44 -04:00
|
|
|
"github.com/minio/minio/pkg/crypto/md5"
|
2014-12-20 19:01:27 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test(t *testing.T) { TestingT(t) }
|
|
|
|
|
|
|
|
type MySuite struct{}
|
|
|
|
|
|
|
|
var _ = Suite(&MySuite{})
|
|
|
|
|
|
|
|
func (s *MySuite) TestMd5sum(c *C) {
|
|
|
|
testString := []byte("Test string")
|
|
|
|
expectedHash, _ := hex.DecodeString("0fd3dbec9730101bff92acc820befc34")
|
2015-03-06 04:50:51 -05:00
|
|
|
hash, err := md5.Sum(bytes.NewBuffer(testString))
|
2014-12-20 19:01:27 -05:00
|
|
|
c.Assert(err, IsNil)
|
|
|
|
c.Assert(bytes.Equal(expectedHash, hash), Equals, true)
|
|
|
|
}
|