decode addr test case

pull/29/head
Paul Shapiro 6 years ago
parent ba2901a57c
commit 5f54c5aa8f

@ -53,7 +53,7 @@ DecodedAddress_RetVals address_utils::decodedAddress(const string &addressString
addressString
);
if (didSucceed == false) {
retVals.errStr = "Invalid address"; // TODO: return code
retVals.err_str = "Invalid address"; // TODO: return code
//
return retVals;
}

@ -42,10 +42,8 @@ namespace monero
{
struct DecodedAddress_RetVals: tools::RetVals_base
{ // TODO: inherit from tools__ret_vals
optional<string> errStr;
//
string pub_viewKey_string;
string pub_spendKey_string;
optional<string> pub_viewKey_string;
optional<string> pub_spendKey_string;
bool isSubaddress;
optional<string> paymentID_string;
};

@ -33,13 +33,15 @@
//
#include <string>
#include <boost/optional.hpp>
using namespace std;
using namespace boost;
//
namespace tools
{
struct RetVals_base
{
bool did_error = false;
boost::optional<std::string> err_string = boost::none;
optional<string> err_str = none;
//
// derive *_RetVals structs from this type and add your own members
};

@ -49,6 +49,15 @@ using namespace std;
#include "../src/monero_address_utils.hpp"
BOOST_AUTO_TEST_CASE(decodeAddress)
{
BOOST_REQUIRE(true);
std::cout << "Testing...." << std::endl;
string address = "43zxvpcj5Xv9SEkNXbMCG7LPQStHMpFCQCmkmR4u5nzjWwq5Xkv5VmGgYEsHXg4ja2FGRD5wMWbBVMijDTqmmVqm93wHGkg";
auto result = monero::address_utils::decodedAddress(address, false);
if (result.err_str) {
std::cout << *result.err_str << endl;
BOOST_REQUIRE(!result.err_str);
}
BOOST_REQUIRE(result.pub_viewKey_string != none);
BOOST_REQUIRE(result.pub_spendKey_string != none);
BOOST_REQUIRE(result.isSubaddress == false);
BOOST_REQUIRE(result.paymentID_string == none);
std::cout << "Decoded: " << address << std::endl;
}

Loading…
Cancel
Save