initial commit
This commit is contained in:
commit
54576d9d33
61 changed files with 5569 additions and 0 deletions
22
internal/key/key_test.go
Normal file
22
internal/key/key_test.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package key
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGenerate(t *testing.T) {
|
||||
plain, prefix, hash, err := Generate()
|
||||
if err != nil {
|
||||
t.Fatalf("Generate() error = %v", err)
|
||||
}
|
||||
if err := ValidateFormat(plain); err != nil {
|
||||
t.Fatalf("generated key is invalid: %v", err)
|
||||
}
|
||||
if prefix != plain[:11] {
|
||||
t.Fatalf("prefix = %q", prefix)
|
||||
}
|
||||
if !bytes.Equal(hash, Hash(plain)) {
|
||||
t.Fatal("hash mismatch")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue