You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
548 B

package crypto
import (
"bytes"
"testing"
)
func TestSimpleArmor(t *testing.T) {
blockType := "MINT TEST"
data := []byte("somedata")
armorStr := EncodeArmor(blockType, nil, data)
t.Log("Got armor: ", armorStr)
// Decode armorStr and test for equivalence.
blockType2, _, data2, err := DecodeArmor(armorStr)
if err != nil {
t.Error(err)
}
if blockType != blockType2 {
t.Errorf("Expected block type %v but got %v", blockType, blockType2)
}
if !bytes.Equal(data, data2) {
t.Errorf("Expected data %X but got %X", data2, data)
}
}