mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
libwallet_api: Wallet::amountFromString fixed
This commit is contained in:
parent
32bc7b41c0
commit
bcf7b67cd6
@ -129,7 +129,7 @@ string Wallet::displayAmount(uint64_t amount)
|
|||||||
|
|
||||||
uint64_t Wallet::amountFromString(const string &amount)
|
uint64_t Wallet::amountFromString(const string &amount)
|
||||||
{
|
{
|
||||||
uint64_t result;
|
uint64_t result = 0;
|
||||||
cryptonote::parse_amount(result, amount);
|
cryptonote::parse_amount(result, amount);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,26 @@ TEST_F(WalletManagerTest, WalletManagerOpensWallet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(WalletManagerTest, WalletMaxAmountAsString)
|
||||||
|
{
|
||||||
|
LOG_PRINT_L3("max amount: " << Bitmonero::Wallet::displayAmount(
|
||||||
|
Bitmonero::Wallet::maximumAllowedAmount()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(WalletManagerTest, WalletAmountFromString)
|
||||||
|
{
|
||||||
|
uint64_t amount = Bitmonero::Wallet::amountFromString("18446740");
|
||||||
|
ASSERT_TRUE(amount > 0);
|
||||||
|
amount = Bitmonero::Wallet::amountFromString("11000000000000");
|
||||||
|
ASSERT_FALSE(amount > 0);
|
||||||
|
amount = Bitmonero::Wallet::amountFromString("0.0");
|
||||||
|
ASSERT_FALSE(amount > 0);
|
||||||
|
amount = Bitmonero::Wallet::amountFromString("10.1");
|
||||||
|
ASSERT_TRUE(amount > 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void open_wallet(Bitmonero::WalletManager *wmgr, Bitmonero::Wallet **wallet, const std::string &pass, std::mutex *mutex)
|
void open_wallet(Bitmonero::WalletManager *wmgr, Bitmonero::Wallet **wallet, const std::string &pass, std::mutex *mutex)
|
||||||
{
|
{
|
||||||
if (mutex)
|
if (mutex)
|
||||||
@ -226,6 +246,9 @@ void open_wallet(Bitmonero::WalletManager *wmgr, Bitmonero::Wallet **wallet, con
|
|||||||
mutex->unlock();
|
mutex->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TEST_F(WalletManagerTest, WalletManagerOpensWalletWithPasswordAndReopenMultiThreaded)
|
//TEST_F(WalletManagerTest, WalletManagerOpensWalletWithPasswordAndReopenMultiThreaded)
|
||||||
//{
|
//{
|
||||||
// // create password protected wallet
|
// // create password protected wallet
|
||||||
|
Loading…
Reference in New Issue
Block a user