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

* Fixes RIPD-269
This commit is contained in:
Howard Hinnant
2020-05-14 17:21:53 -04:00
committed by manojsdoshi
parent 0290d0b82c
commit 2d23e7bd18
3 changed files with 9 additions and 20 deletions

View File

@@ -1871,9 +1871,7 @@ class AccountTxPaging_test : public beast::unit_test::suite
if (!BEAST_EXPECT(status.error_code() == 0)) if (!BEAST_EXPECT(status.error_code() == 0))
return; return;
if (!BEAST_EXPECT( if (!BEAST_EXPECT(res.transactions().size() == std::size(txCheck)))
res.transactions().size() ==
std::extent<decltype(txCheck)>::value))
return; return;
for (int i = 0; i < res.transactions().size(); ++i) for (int i = 0; i < res.transactions().size(); ++i)
{ {

View File

@@ -321,11 +321,8 @@ public:
LedgerSeq BIGINT UNSIGNED \ LedgerSeq BIGINT UNSIGNED \
);", );",
"CREATE INDEX SeqLedger ON Ledgers(LedgerSeq);"}; "CREATE INDEX SeqLedger ON Ledgers(LedgerSeq);"};
int dbInitCount = std::extent<decltype(dbInit)>::value; for (auto const c : dbInit)
for (int i = 0; i < dbInitCount; ++i) s << c;
{
s << dbInit[i];
}
char lh[65]; char lh[65];
memset(lh, 'a', 64); memset(lh, 'a', 64);
lh[64] = '\0'; lh[64] = '\0';

View File

@@ -445,12 +445,9 @@ class AccountTx_test : public beast::unit_test::suite
// clang-format on // clang-format on
BEAST_EXPECT( BEAST_EXPECT(
std::extent<decltype(sanity)>::value == std::size(sanity) == result[jss::result][jss::transactions].size());
result[jss::result][jss::transactions].size());
for (unsigned int index{0}; for (unsigned int index{0}; index < std::size(sanity); ++index)
index < std::extent<decltype(sanity)>::value;
++index)
{ {
checkSanity(txs[index], sanity[index]); checkSanity(txs[index], sanity[index]);
} }
@@ -531,14 +528,14 @@ class AccountTx_test : public beast::unit_test::suite
// The first two transactions listed in sanity haven't happened yet. // The first two transactions listed in sanity haven't happened yet.
constexpr unsigned int beckyDeletedOffest = 2; constexpr unsigned int beckyDeletedOffest = 2;
BEAST_EXPECT( BEAST_EXPECT(
std::extent<decltype(sanity)>::value == std::size(sanity) ==
result[jss::result][jss::transactions].size() + result[jss::result][jss::transactions].size() +
beckyDeletedOffest); beckyDeletedOffest);
Json::Value const& txs{result[jss::result][jss::transactions]}; Json::Value const& txs{result[jss::result][jss::transactions]};
for (unsigned int index = beckyDeletedOffest; for (unsigned int index = beckyDeletedOffest;
index < std::extent<decltype(sanity)>::value; index < std::size(sanity);
++index) ++index)
{ {
checkSanity(txs[index - beckyDeletedOffest], sanity[index]); checkSanity(txs[index - beckyDeletedOffest], sanity[index]);
@@ -576,14 +573,11 @@ class AccountTx_test : public beast::unit_test::suite
BEAST_EXPECT(result[jss::result][jss::transactions].isArray()); BEAST_EXPECT(result[jss::result][jss::transactions].isArray());
BEAST_EXPECT( BEAST_EXPECT(
std::extent<decltype(sanity)>::value == std::size(sanity) == result[jss::result][jss::transactions].size());
result[jss::result][jss::transactions].size());
Json::Value const& txs{result[jss::result][jss::transactions]}; Json::Value const& txs{result[jss::result][jss::transactions]};
for (unsigned int index = 0; for (unsigned int index = 0; index < std::size(sanity); ++index)
index < std::extent<decltype(sanity)>::value;
++index)
{ {
checkSanity(txs[index], sanity[index]); checkSanity(txs[index], sanity[index]);
} }