1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-13 09:12:28 +08:00

refactor: rename package 'utils' to 'internal'

This commit is contained in:
dudaodong
2021-12-31 11:36:11 +08:00
parent e15ae9eb98
commit c625a88067
15 changed files with 142 additions and 142 deletions

View File

@@ -3,7 +3,7 @@ package cryptor
import (
"testing"
"github.com/duke-git/lancet/utils"
"github.com/duke-git/lancet/internal"
)
func TestAesEcbEncrypt(t *testing.T) {
@@ -14,7 +14,7 @@ func TestAesEcbEncrypt(t *testing.T) {
aesEcbDecrypt := AesEcbDecrypt(aesEcbEncrypt, []byte(key))
if string(aesEcbDecrypt) != data {
utils.LogFailedTestInfo(t, "AesEcbEncrypt/AesEcbDecrypt", data, data, string(aesEcbDecrypt))
internal.LogFailedTestInfo(t, "AesEcbEncrypt/AesEcbDecrypt", data, data, string(aesEcbDecrypt))
t.FailNow()
}
}
@@ -27,7 +27,7 @@ func TestAesCbcEncrypt(t *testing.T) {
aesCbcDecrypt := AesCbcDecrypt(aesCbcEncrypt, []byte(key))
if string(aesCbcDecrypt) != data {
utils.LogFailedTestInfo(t, "AesCbcEncrypt/AesCbcDecrypt", data, data, string(aesCbcDecrypt))
internal.LogFailedTestInfo(t, "AesCbcEncrypt/AesCbcDecrypt", data, data, string(aesCbcDecrypt))
t.FailNow()
}
}
@@ -40,7 +40,7 @@ func TestAesCtrCrypt(t *testing.T) {
aesCtrDeCrypt := AesCtrCrypt(aesCtrCrypt, []byte(key))
if string(aesCtrDeCrypt) != data {
utils.LogFailedTestInfo(t, "AesCtrCrypt", data, data, string(aesCtrDeCrypt))
internal.LogFailedTestInfo(t, "AesCtrCrypt", data, data, string(aesCtrDeCrypt))
t.FailNow()
}
}
@@ -53,7 +53,7 @@ func TestAesCfbEncrypt(t *testing.T) {
aesCfbDecrypt := AesCfbDecrypt(aesCfbEncrypt, []byte(key))
if string(aesCfbDecrypt) != data {
utils.LogFailedTestInfo(t, "AesCfbEncrypt/AesCfbDecrypt", data, data, string(aesCfbDecrypt))
internal.LogFailedTestInfo(t, "AesCfbEncrypt/AesCfbDecrypt", data, data, string(aesCfbDecrypt))
t.FailNow()
}
}
@@ -66,7 +66,7 @@ func TestAesOfbEncrypt(t *testing.T) {
aesOfbDecrypt := AesOfbDecrypt(aesOfbEncrypt, []byte(key))
if string(aesOfbDecrypt) != data {
utils.LogFailedTestInfo(t, "AesOfbEncrypt/AesOfbDecrypt", data, data, string(aesOfbDecrypt))
internal.LogFailedTestInfo(t, "AesOfbEncrypt/AesOfbDecrypt", data, data, string(aesOfbDecrypt))
t.FailNow()
}
}

View File

@@ -5,7 +5,7 @@ import (
"os"
"testing"
"github.com/duke-git/lancet/utils"
"github.com/duke-git/lancet/internal"
)
func TestBase64StdEncode(t *testing.T) {
@@ -13,7 +13,7 @@ func TestBase64StdEncode(t *testing.T) {
bs := Base64StdEncode(s)
if bs != "aGVsbG8gd29ybGQ=" {
utils.LogFailedTestInfo(t, "Base64StdEncode", s, "aGVsbG8gd29ybGQ=", bs)
internal.LogFailedTestInfo(t, "Base64StdEncode", s, "aGVsbG8gd29ybGQ=", bs)
t.FailNow()
}
}
@@ -23,7 +23,7 @@ func TestBase64StdDecode(t *testing.T) {
s := Base64StdDecode(bs)
if s != "hello world" {
utils.LogFailedTestInfo(t, "Base64StdDecode", bs, "hello world=", s)
internal.LogFailedTestInfo(t, "Base64StdDecode", bs, "hello world=", s)
t.FailNow()
}
}
@@ -34,7 +34,7 @@ func TestMd5String(t *testing.T) {
expected := "5d41402abc4b2a76b9719d911017c592"
if smd5 != expected {
utils.LogFailedTestInfo(t, "Md5String", s, expected, smd5)
internal.LogFailedTestInfo(t, "Md5String", s, expected, smd5)
t.FailNow()
}
}
@@ -58,7 +58,7 @@ func TestHmacMd5(t *testing.T) {
expected := "5f4c9faaff0a1ad3007d9ddc06abe36d"
if hmacMd5 != expected {
utils.LogFailedTestInfo(t, "HmacMd5", s, expected, hmacMd5)
internal.LogFailedTestInfo(t, "HmacMd5", s, expected, hmacMd5)
t.FailNow()
}
}
@@ -70,7 +70,7 @@ func TestHmacSha1(t *testing.T) {
expected := "3826f812255d8683f051ee97346d1359234d5dbd"
if hmacSha1 != expected {
utils.LogFailedTestInfo(t, "HmacSha1", s, expected, hmacSha1)
internal.LogFailedTestInfo(t, "HmacSha1", s, expected, hmacSha1)
t.FailNow()
}
}
@@ -82,7 +82,7 @@ func TestHmacSha256(t *testing.T) {
expected := "9dce2609f2d67d41f74c7f9efc8ccd44370d41ad2de52982627588dfe7289ab8"
if hmacSha256 != expected {
utils.LogFailedTestInfo(t, "HmacSha256", s, expected, hmacSha256)
internal.LogFailedTestInfo(t, "HmacSha256", s, expected, hmacSha256)
t.FailNow()
}
}
@@ -94,7 +94,7 @@ func TestHmacSha512(t *testing.T) {
expected := "5b1563ac4e9b49c9ada8ccb232588fc4f0c30fd12f756b3a0b95af4985c236ca60925253bae10ce2c6bf9af1c1679b51e5395ff3d2826c0a2c7c0d72225d4175"
if hmacSha512 != expected {
utils.LogFailedTestInfo(t, "HmacSha512", s, expected, hmacSha512)
internal.LogFailedTestInfo(t, "HmacSha512", s, expected, hmacSha512)
t.FailNow()
}
}
@@ -105,7 +105,7 @@ func TestSha1(t *testing.T) {
expected := "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"
if sha1 != expected {
utils.LogFailedTestInfo(t, "Sha1", s, expected, sha1)
internal.LogFailedTestInfo(t, "Sha1", s, expected, sha1)
t.FailNow()
}
}
@@ -116,7 +116,7 @@ func TestSha256(t *testing.T) {
expected := "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
if sha256 != expected {
utils.LogFailedTestInfo(t, "Sha256", s, expected, sha256)
internal.LogFailedTestInfo(t, "Sha256", s, expected, sha256)
t.FailNow()
}
}
@@ -127,7 +127,7 @@ func TestSha512(t *testing.T) {
expected := "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f"
if sha512 != expected {
utils.LogFailedTestInfo(t, "Sha512", s, expected, sha512)
internal.LogFailedTestInfo(t, "Sha512", s, expected, sha512)
t.FailNow()
}
}

View File

@@ -3,7 +3,7 @@ package cryptor
import (
"testing"
"github.com/duke-git/lancet/utils"
"github.com/duke-git/lancet/internal"
)
func TestDesEcbEncrypt(t *testing.T) {
@@ -14,7 +14,7 @@ func TestDesEcbEncrypt(t *testing.T) {
desEcbDecrypt := DesEcbDecrypt(desEcbEncrypt, []byte(key))
if string(desEcbDecrypt) != data {
utils.LogFailedTestInfo(t, "DesEcbEncrypt/DesEcbDecrypt", data, data, string(desEcbDecrypt))
internal.LogFailedTestInfo(t, "DesEcbEncrypt/DesEcbDecrypt", data, data, string(desEcbDecrypt))
t.FailNow()
}
}
@@ -27,7 +27,7 @@ func TestDesCbcEncrypt(t *testing.T) {
desCbcDecrypt := DesCbcDecrypt(desCbcEncrypt, []byte(key))
if string(desCbcDecrypt) != data {
utils.LogFailedTestInfo(t, "DesCbcEncrypt/DesCbcDecrypt", data, data, string(desCbcDecrypt))
internal.LogFailedTestInfo(t, "DesCbcEncrypt/DesCbcDecrypt", data, data, string(desCbcDecrypt))
t.FailNow()
}
}
@@ -40,7 +40,7 @@ func TestDesCtrCrypt(t *testing.T) {
desCtrDeCrypt := DesCtrCrypt(desCtrCrypt, []byte(key))
if string(desCtrDeCrypt) != data {
utils.LogFailedTestInfo(t, "DesCtrCrypt", data, data, string(desCtrDeCrypt))
internal.LogFailedTestInfo(t, "DesCtrCrypt", data, data, string(desCtrDeCrypt))
t.FailNow()
}
}
@@ -53,7 +53,7 @@ func TestDesCfbEncrypt(t *testing.T) {
desCfbDecrypt := DesCfbDecrypt(desCfbEncrypt, []byte(key))
if string(desCfbDecrypt) != data {
utils.LogFailedTestInfo(t, "DesCfbEncrypt/DesCfbDecrypt", data, data, string(desCfbDecrypt))
internal.LogFailedTestInfo(t, "DesCfbEncrypt/DesCfbDecrypt", data, data, string(desCfbDecrypt))
t.FailNow()
}
}
@@ -66,7 +66,7 @@ func TestDesOfbEncrypt(t *testing.T) {
desOfbDecrypt := DesOfbDecrypt(desOfbEncrypt, []byte(key))
if string(desOfbDecrypt) != data {
utils.LogFailedTestInfo(t, "DesOfbEncrypt/DesOfbDecrypt", data, data, string(desOfbDecrypt))
internal.LogFailedTestInfo(t, "DesOfbEncrypt/DesOfbDecrypt", data, data, string(desOfbDecrypt))
t.FailNow()
}
}

View File

@@ -3,7 +3,7 @@ package cryptor
import (
"testing"
"github.com/duke-git/lancet/utils"
"github.com/duke-git/lancet/internal"
)
func TestRsaEncrypt(t *testing.T) {
@@ -13,7 +13,7 @@ func TestRsaEncrypt(t *testing.T) {
decrypted := RsaDecrypt(encrypted, "rsa_private.pem")
if string(data) != string(decrypted) {
utils.LogFailedTestInfo(t, "RsaEncrypt/RsaDecrypt", string(data), string(data), string(decrypted))
internal.LogFailedTestInfo(t, "RsaEncrypt/RsaDecrypt", string(data), string(data), string(decrypted))
t.FailNow()
}
}