Update tests

This commit is contained in:
Tobie Morgan Hitchcock 2016-08-28 09:29:31 +01:00
parent 814fee772f
commit e8bb3f0654

View file

@ -56,6 +56,20 @@ func TestBlank(t *testing.T) {
} }
func TestCorrupt(t *testing.T) {
key := []byte("1hg7dbrma8ghe547")
enc := []byte("corrupt")
Convey("Cryptography should fail", t, func() {
dec, _ := Decrypt(key, enc)
Convey("Decrypt", func() {
So(dec, ShouldResemble, enc)
})
})
}
func TestInvalid(t *testing.T) { func TestInvalid(t *testing.T) {
key := []byte("invalidkey") key := []byte("invalidkey")
@ -74,6 +88,36 @@ func TestInvalid(t *testing.T) {
} }
func TestInvalidD(t *testing.T) {
val := []byte("1hg7dbrma8ghe547")
key := []byte("invalidkey")
str := []byte("Hello World")
Convey("Decryption should fail", t, func() {
enc, _ := Encrypt(val, str)
dec, _ := Decrypt(key, enc)
Convey("Decrypt", func() {
So(dec, ShouldResemble, []byte(nil))
})
})
}
func TestInvalidE(t *testing.T) {
key := []byte("invalidkey")
str := []byte("Hello World")
Convey("Encryption should fail", t, func() {
enc, _ := Encrypt(key, str)
Convey("Encrypt", func() {
So(enc, ShouldResemble, []byte(nil))
})
})
}
func TestAES128(t *testing.T) { func TestAES128(t *testing.T) {
key := []byte("1hg7dbrma8ghe547") key := []byte("1hg7dbrma8ghe547")