Skip to content

Commit

Permalink
[REBASE] Minor improvements to test
Browse files Browse the repository at this point in the history
  • Loading branch information
scottschurr committed Jun 28, 2024
1 parent 513e929 commit b32cc72
Showing 1 changed file with 35 additions and 37 deletions.
72 changes: 35 additions & 37 deletions src/test/app/NFToken_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7755,7 +7755,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite
Account const alice("alice");
Account const bob("bob");

bool modifyEnabled = features[featureDynamicNFT];
bool const modifyEnabled = features[featureDynamicNFT];

{
// Mint with tfMutable
Expand Down Expand Up @@ -7889,47 +7889,45 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite
};

// lambda that checks for the expected URI value of an NFToken
auto checkURI =
[&accountNFTs, this](
Account const& acct, char const* uri, int line) {
auto nfts = accountNFTs(acct);
if (nfts.size() == 1)
pass();
else
{
std::ostringstream description;
description << "checkURI: unexpected NFT count on line "
<< line;
fail(description.str(), __FILE__, line);
return;
}

if (uri == nullptr)
{
if (!nfts[0u].isMember(sfURI.jsonName))
pass();
else
{
std::ostringstream description;
description
<< "checkURI: unexpected URI present on line "
<< line;
fail(description.str(), __FILE__, line);
}
return;
}
auto checkURI = [&accountNFTs, this](
Account const& acct,
char const* uri,
int line) {
auto const nfts = accountNFTs(acct);
if (nfts.size() == 1)
pass();
else
{
std::ostringstream text;
text << "checkURI: unexpected NFT count on line " << line;
fail(text.str(), __FILE__, line);
return;
}

if (nfts[0u][sfURI.jsonName] == strHex(std::string(uri)))
if (uri == nullptr)
{
if (!nfts[0u].isMember(sfURI.jsonName))
pass();
else
{
std::ostringstream description;
description
<< "checkURI: unexpected URI contents on line "
<< line;
fail(description.str(), __FILE__, line);
std::ostringstream text;
text << "checkURI: unexpected URI present on line "
<< line;
fail(text.str(), __FILE__, line);
}
};
return;
}

if (nfts[0u][sfURI.jsonName] == strHex(std::string(uri)))
pass();
else
{
std::ostringstream text;
text << "checkURI: unexpected URI contents on line "
<< line;
fail(text.str(), __FILE__, line);
}
};

uint256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)};
env.close();
Expand Down

0 comments on commit b32cc72

Please sign in to comment.