From 4953f83835904a2334707495f764f73ff385094a Mon Sep 17 00:00:00 2001 From: karldoenitz Date: Thu, 12 Oct 2023 15:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_case/utils_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test_case/utils_test.go diff --git a/test_case/utils_test.go b/test_case/utils_test.go new file mode 100644 index 0000000..794b0d7 --- /dev/null +++ b/test_case/utils_test.go @@ -0,0 +1,26 @@ +package test_case + +import ( + "Tigo/TigoWeb" + "testing" +) + +func TestEncryptDecrypt(t *testing.T) { + originData := "test data" + key := "key" + encryptData, err := TigoWeb.Encrypt([]byte(originData), []byte(key)) + if err != nil { + t.Error(err.Error()) + return + } + decryptData, err := TigoWeb.Decrypt([]byte(encryptData), []byte(key)) + if err != nil { + t.Error(err.Error()) + return + } + if string(decryptData) != originData { + t.Error("data invalid") + return + } + t.Log("success") +}