mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Fix Vault unit tests
This commit is contained in:
@@ -556,6 +556,7 @@ STAmount::operator=(Number const& number)
|
||||
mIsNegative = number.mantissa() < 0;
|
||||
mValue = mIsNegative ? -number.mantissa() : number.mantissa();
|
||||
mOffset = number.exponent();
|
||||
canonicalize();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +276,7 @@ STAmount::xrp() const
|
||||
"Cannot return non-native STAmount as XRPAmount");
|
||||
|
||||
auto drops = static_cast<XRPAmount::value_type>(mValue);
|
||||
XRPL_ASSERT(mOffset == 0, "ripple::STAmount::xrp : amount is canonical");
|
||||
|
||||
if (mIsNegative)
|
||||
drops = -drops;
|
||||
@@ -305,6 +306,7 @@ STAmount::mpt() const
|
||||
Throw<std::logic_error>("Cannot return STAmount as MPTAmount");
|
||||
|
||||
auto value = static_cast<MPTAmount::value_type>(mValue);
|
||||
XRPL_ASSERT(mOffset == 0, "ripple::STAmount::mpt : amount is canonical");
|
||||
|
||||
if (mIsNegative)
|
||||
value = -value;
|
||||
|
||||
@@ -175,13 +175,12 @@ class Vault_test : public beast::unit_test::suite
|
||||
env(tx, ter(tecNO_PERMISSION));
|
||||
}
|
||||
|
||||
// TODO: Fix this
|
||||
// {
|
||||
// testcase("delete empty vault");
|
||||
// auto tx = vault.del({.owner = owner, .id = keylet.key});
|
||||
// env(tx);
|
||||
// BEAST_EXPECT(!env.le(keylet));
|
||||
// }
|
||||
{
|
||||
testcase("delete empty vault");
|
||||
auto tx = vault.del({.owner = owner, .id = keylet.key});
|
||||
env(tx);
|
||||
BEAST_EXPECT(!env.le(keylet));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(Sequences)
|
||||
|
||||
@@ -107,14 +107,14 @@ VaultClawback::doApply()
|
||||
vault->at(sfAssetAvailable) -= assets;
|
||||
view().update(vault);
|
||||
|
||||
// auto const& vaultAccount = vault->at(sfAccount);
|
||||
// // Transfer shares from holder to vault.
|
||||
// if (auto ter = accountSend(view(), holder, vaultAccount, shares, j_))
|
||||
// return ter;
|
||||
auto const& vaultAccount = vault->at(sfAccount);
|
||||
// Transfer shares from holder to vault.
|
||||
if (auto ter = accountSend(view(), holder, vaultAccount, shares, j_))
|
||||
return ter;
|
||||
|
||||
// // Transfer assets from vault to issuer.
|
||||
// if (auto ter = accountSend(view(), vaultAccount, account_, assets, j_))
|
||||
// return ter;
|
||||
// Transfer assets from vault to issuer.
|
||||
if (auto ter = accountSend(view(), vaultAccount, account_, assets, j_))
|
||||
return ter;
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user