meowlib/symcrypt_test.go

22 lines
518 B
Go
Raw Permalink Normal View History

2022-09-18 21:17:28 +02:00
package meowlib
import (
"log"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSymEncryptDecrypt(t *testing.T) {
foo := []byte("!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~")
encMess, err := SymEncrypt("mysecretpassword", foo)
if err != nil {
log.Println(err.Error())
}
decMess, err2 := SymDecrypt("mysecretpassword", encMess)
if err2 != nil {
log.Println(err2.Error())
}
assert.Equal(t, foo, decMess, "The two messages should be the same.")
}