diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-09-10 17:40:23 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-09-10 17:40:23 +0100 |
commit | a30d6403f723765b8f9b7609e7eb3ade0f5434a0 (patch) | |
tree | dfd1197c292fa6fa3bcceae5e135bc8e3991f4c0 /client/keys_test.go | |
parent | d422741d8aab8cd4564141da57e2b98eed3c8a85 (diff) |
Make client a top-level package for consistency
Diffstat (limited to 'client/keys_test.go')
-rw-r--r-- | client/keys_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/keys_test.go b/client/keys_test.go new file mode 100644 index 0000000..9e930d5 --- /dev/null +++ b/client/keys_test.go @@ -0,0 +1,28 @@ +package client + +import ( + "reflect" + "testing" +) + +func TestGenerateKeys(t *testing.T) { + var tests = []struct { + key string + size int + want string + }{ + {"ecdsa", 256, "*ecdsa.PrivateKey"}, + {"rsa", 1024, "*rsa.PrivateKey"}, + {"ed25519", 256, "*ed25519.PrivateKey"}, + } + + for _, tst := range tests { + k, _, err := GenerateKey(tst.key, tst.size) + if err != nil { + t.Error(err) + } + if reflect.TypeOf(k).String() != tst.want { + t.Errorf("Wrong key type returned. Got %s, wanted %s", reflect.TypeOf(k).String(), tst.want) + } + } +} |