diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f955ebb..813d0d5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,6 +3,7 @@ set(TEST_SRC main.cpp # ec + ec/generate.cpp ec/pubkey.cpp # Base58 diff --git a/tests/ec/generate.cpp b/tests/ec/generate.cpp new file mode 100644 index 0000000..4fe610d --- /dev/null +++ b/tests/ec/generate.cpp @@ -0,0 +1,18 @@ +#include +#include + +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(); +} \ No newline at end of file