mirror of
https://github.com/Xahau/xahaud.git
synced 2026-07-29 18:10:12 +00:00
Update SetRemarks_test.cpp
This commit is contained in:
@@ -17,46 +17,22 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/core/ConfigSections.h>
|
||||
#include <ripple/ledger/Directory.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
struct SetRemarks_test : public beast::unit_test::suite
|
||||
{
|
||||
static bool
|
||||
inOwnerDir(
|
||||
ReadView const& view,
|
||||
jtx::Account const& acct,
|
||||
uint256 const& tid)
|
||||
{
|
||||
auto const uritSle = view.read({ltURI_TOKEN, tid});
|
||||
ripple::Dir const ownerDir(view, keylet::ownerDir(acct.id()));
|
||||
return std::find(ownerDir.begin(), ownerDir.end(), uritSle) !=
|
||||
ownerDir.end();
|
||||
}
|
||||
|
||||
static std::size_t
|
||||
ownerDirCount(ReadView const& view, jtx::Account const& acct)
|
||||
{
|
||||
ripple::Dir const ownerDir(view, keylet::ownerDir(acct.id()));
|
||||
return std::distance(ownerDir.begin(), ownerDir.end());
|
||||
};
|
||||
|
||||
void
|
||||
testEnabled(FeatureBitset features)
|
||||
{
|
||||
testcase("enabled");
|
||||
using namespace jtx;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
// setup env
|
||||
auto const alice = Account("alice");
|
||||
@@ -64,58 +40,14 @@ struct SetRemarks_test : public beast::unit_test::suite
|
||||
|
||||
for (bool const withRemarks : {false, true})
|
||||
{
|
||||
std::cout << "RESULT" << "\n";
|
||||
// // If the URIToken amendment is not enabled, you should not be able
|
||||
// // to mint, burn, buy, sell or clear uri tokens.
|
||||
// auto const amend =
|
||||
// withURIToken ? features : features - featureURIToken;
|
||||
// Env env{*this, amend};
|
||||
std::cout << "With Remarks: " << withRemarks << "\n";
|
||||
// If the Remarks amendment is not enabled, you cannot add remarks
|
||||
auto const amend =
|
||||
withRemarks ? features : features - featureRemarks;
|
||||
Env env{*this, amend};
|
||||
|
||||
// env.fund(XRP(1000), alice, bob);
|
||||
// env.close();
|
||||
|
||||
// std::string const uri(maxTokenURILength, '?');
|
||||
// std::string const id{strHex(uritoken::tokenid(alice, uri))};
|
||||
|
||||
// auto const txResult =
|
||||
// withURIToken ? ter(tesSUCCESS) : ter(temDISABLED);
|
||||
// auto const ownerDir = withURIToken ? 1 : 0;
|
||||
|
||||
// // MINT
|
||||
// env(uritoken::mint(alice, uri), txResult);
|
||||
// env.close();
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), alice) == ownerDir);
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), bob) == 0);
|
||||
|
||||
// // SELL
|
||||
// env(uritoken::sell(alice, id), uritoken::amt(XRP(10)), txResult);
|
||||
// env.close();
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), alice) == ownerDir);
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), bob) == 0);
|
||||
|
||||
// // BUY
|
||||
// env(uritoken::buy(bob, id), uritoken::amt(XRP(10)), txResult);
|
||||
// env.close();
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), alice) == 0);
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), bob) == ownerDir);
|
||||
|
||||
// // SELL
|
||||
// env(uritoken::sell(bob, id), uritoken::amt(XRP(10)), txResult);
|
||||
// env.close();
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), alice) == 0);
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), bob) == ownerDir);
|
||||
|
||||
// // CLEAR
|
||||
// env(uritoken::cancel(bob, id), txResult);
|
||||
// env.close();
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), alice) == 0);
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), bob) == ownerDir);
|
||||
|
||||
// // BURN
|
||||
// env(uritoken::burn(bob, id), txResult);
|
||||
// env.close();
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), alice) == 0);
|
||||
// BEAST_EXPECT(ownerDirCount(*env.current(), bob) == 0);
|
||||
env.fund(XRP(1000), alice, bob);
|
||||
env.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user