Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::size in place of std::extent #3403

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/test/app/AccountTxPaging_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1871,9 +1871,7 @@ class AccountTxPaging_test : public beast::unit_test::suite
if (!BEAST_EXPECT(status.error_code() == 0))
return;

if (!BEAST_EXPECT(
res.transactions().size() ==
std::extent<decltype(txCheck)>::value))
if (!BEAST_EXPECT(res.transactions().size() == std::size(txCheck)))
return;
for (int i = 0; i < res.transactions().size(); ++i)
{
Expand Down
7 changes: 2 additions & 5 deletions src/test/core/SociDB_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,8 @@ class SociDB_test final : public TestSuite
LedgerSeq BIGINT UNSIGNED \
);",
"CREATE INDEX SeqLedger ON Ledgers(LedgerSeq);"};
int dbInitCount = std::extent<decltype(dbInit)>::value;
for (int i = 0; i < dbInitCount; ++i)
{
s << dbInit[i];
}
for (auto const c : dbInit)
s << c;
char lh[65];
memset(lh, 'a', 64);
lh[64] = '\0';
Expand Down
18 changes: 6 additions & 12 deletions src/test/rpc/AccountTx_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,9 @@ class AccountTx_test : public beast::unit_test::suite
// clang-format on

BEAST_EXPECT(
std::extent<decltype(sanity)>::value ==
result[jss::result][jss::transactions].size());
std::size(sanity) == result[jss::result][jss::transactions].size());

for (unsigned int index{0};
index < std::extent<decltype(sanity)>::value;
++index)
for (unsigned int index{0}; index < std::size(sanity); ++index)
{
checkSanity(txs[index], sanity[index]);
}
Expand Down Expand Up @@ -531,14 +528,14 @@ class AccountTx_test : public beast::unit_test::suite
// The first two transactions listed in sanity haven't happened yet.
constexpr unsigned int beckyDeletedOffest = 2;
BEAST_EXPECT(
std::extent<decltype(sanity)>::value ==
std::size(sanity) ==
result[jss::result][jss::transactions].size() +
beckyDeletedOffest);

Json::Value const& txs{result[jss::result][jss::transactions]};

for (unsigned int index = beckyDeletedOffest;
index < std::extent<decltype(sanity)>::value;
index < std::size(sanity);
++index)
{
checkSanity(txs[index - beckyDeletedOffest], sanity[index]);
Expand Down Expand Up @@ -576,14 +573,11 @@ class AccountTx_test : public beast::unit_test::suite
BEAST_EXPECT(result[jss::result][jss::transactions].isArray());

BEAST_EXPECT(
std::extent<decltype(sanity)>::value ==
result[jss::result][jss::transactions].size());
std::size(sanity) == result[jss::result][jss::transactions].size());

Json::Value const& txs{result[jss::result][jss::transactions]};

for (unsigned int index = 0;
index < std::extent<decltype(sanity)>::value;
++index)
for (unsigned int index = 0; index < std::size(sanity); ++index)
{
checkSanity(txs[index], sanity[index]);
}
Expand Down