mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-06-16 19:50:01 +02:00
Adding tests/ec/generate.cpp
This commit is contained in:
parent
171876bbfa
commit
6eaf6ebe71
2 changed files with 19 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ set(TEST_SRC
|
|||
main.cpp
|
||||
|
||||
# ec
|
||||
ec/generate.cpp
|
||||
ec/pubkey.cpp
|
||||
|
||||
# Base58
|
||||
|
|
|
|||
18
tests/ec/generate.cpp
Normal file
18
tests/ec/generate.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <doctest.h>
|
||||
|
||||
TEST_CASE("ec::generate") {
|
||||
|
||||
libeosio::ec_init();
|
||||
|
||||
libeosio::ec_pubkey_t result;
|
||||
libeosio::ec_keypair pair;
|
||||
CHECK(libeosio::ec_generate_key(&pair) == 0);
|
||||
|
||||
// Can't test much because... well the private key should be random :)
|
||||
// But alteast verify that the public key belongs to the private key.
|
||||
CHECK(libeosio::ec_get_publickey(&pair.secret, &result) == 0);
|
||||
CHECK( result == pair.pub );
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue