Skip to content

Commit

Permalink
增加一个测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
karldoenitz committed Oct 12, 2023
1 parent 56bdab0 commit 4953f83
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test_case/utils_test.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 4953f83

Please sign in to comment.