mirror of https://github.com/rocboss/paopao-ce
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.
45 lines
836 B
45 lines
836 B
2 years ago
|
// Copyright 2023 ROC. All rights reserved.
|
||
2 years ago
|
// Use of this source code is governed by a MIT style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
2 years ago
|
package utils_test
|
||
3 years ago
|
|
||
2 years ago
|
import (
|
||
|
. "github.com/onsi/ginkgo/v2"
|
||
|
. "github.com/onsi/gomega"
|
||
3 years ago
|
|
||
2 years ago
|
"github.com/rocboss/paopao-ce/pkg/utils"
|
||
2 years ago
|
)
|
||
|
|
||
|
var _ = Describe("Md5", Ordered, func() {
|
||
|
type md5Cases []struct {
|
||
3 years ago
|
value string
|
||
2 years ago
|
md5 string
|
||
3 years ago
|
}
|
||
2 years ago
|
var samples md5Cases
|
||
|
|
||
|
BeforeAll(func() {
|
||
|
samples = md5Cases{
|
||
|
{
|
||
3 years ago
|
value: "123456",
|
||
2 years ago
|
md5: "e10adc3949ba59abbe56e057f20f883e",
|
||
3 years ago
|
},
|
||
2 years ago
|
{
|
||
3 years ago
|
value: "",
|
||
2 years ago
|
md5: "d41d8cd98f00b204e9800998ecf8427e", // really odd, why?
|
||
3 years ago
|
},
|
||
2 years ago
|
{
|
||
3 years ago
|
value: "paopaocestr",
|
||
2 years ago
|
md5: "8a5033dda1a8919224c66e68d846a289",
|
||
3 years ago
|
},
|
||
2 years ago
|
}
|
||
|
})
|
||
|
|
||
|
It("encode md5", func() {
|
||
|
for _, t := range samples {
|
||
2 years ago
|
Expect(utils.EncodeMD5(t.value)).To(Equal(t.md5))
|
||
2 years ago
|
}
|
||
|
})
|
||
|
|
||
|
})
|