Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ShellyWEI committed Dec 3, 2019
1 parent 701f21a commit a7ad774
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crypto/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

const (
KeyString = "CAISIJFNZZd5ZSvi9OlJP/mz/vvUobvlrr2//QN4DzX/EShP"
EncryptKey = "Tron2theMoon1234"
)

func TestSignVerify(t *testing.T) {
Expand Down Expand Up @@ -44,3 +45,13 @@ func TestSignVerify(t *testing.T) {
t.Error("Verify with public key failed")
}
}

func TestEncryptDecrypt(t *testing.T) {
origin := "Hello World"
key := []byte(EncryptKey)
encryptMsg, _ := Encrypt(key, []byte(origin))
msg, _ := Decrypt(key, []byte(encryptMsg))
if string(msg) != origin {
t.Errorf("Decrypt failed")
}
}

0 comments on commit a7ad774

Please sign in to comment.