Fix unit test compiler warnings

This commit is contained in:
Brad Chase
2017-08-14 16:44:18 -04:00
committed by Nik Bougalis
parent be1f734845
commit a02a469b20
5 changed files with 20 additions and 13 deletions

View File

@@ -747,8 +747,9 @@ struct Flow_test : public beast::unit_test::suite
auto const timeDelta = Env{*this}.closed ()->info ().closeTimeResolution;
for(auto const& d: {-timeDelta*100, +timeDelta*100}){
auto const closeTime = fix1141Time () + d;
for (auto const& d : {-100 * timeDelta, +100 * timeDelta})
{
auto const closeTime = fix1141Time () + d ;
Env env (*this, no_features);
env.close (closeTime);
@@ -1112,7 +1113,7 @@ struct Flow_test : public beast::unit_test::suite
using namespace jtx;
Env env(*this, with_features(featureFlow));
auto const timeDelta = env.closed ()->info ().closeTimeResolution;
auto const d = withFix ? timeDelta*100 : -timeDelta*100;
auto const d = withFix ? 100*timeDelta : -100*timeDelta;
auto closeTime = fix1443Time() + d;
env.close(closeTime);
@@ -1165,7 +1166,7 @@ struct Flow_test : public beast::unit_test::suite
using namespace jtx;
Env env(*this, with_features(featureFlow));
auto const timeDelta = env.closed ()->info ().closeTimeResolution;
auto const d = withFix ? timeDelta*100 : -timeDelta*100;
auto const d = withFix ? 100*timeDelta : -100*timeDelta;
auto closeTime = fix1449Time() + d;
env.close(closeTime);

View File

@@ -253,11 +253,10 @@ public:
for (int i=0;i<101;++i)
env (offer (carol, USD (1), EUR (2)));
for (auto timeDelta : {
- env.closed()->info().closeTimeResolution,
env.closed()->info().closeTimeResolution} )
for (auto d : {-1, 1})
{
auto const closeTime = STAmountSO::soTime + timeDelta;
auto const closeTime = STAmountSO::soTime +
d * env.closed()->info().closeTimeResolution;
env.close (closeTime);
*stAmountCalcSwitchover = closeTime > STAmountSO::soTime;
// Will fail without the underflow fix

View File

@@ -142,6 +142,13 @@ public:
return true;
}
template <class U>
bool operator!= (AllocT <U> const& o) const
{
return !(*this == o);
}
T* allocate (std::size_t n, T const* = 0)
{
return static_cast <T*> (

View File

@@ -250,7 +250,7 @@ class Invariants_test : public beast::unit_test::suite
auto const sle = ac.view().peek (keylet::account(A1.id()));
if(! sle)
return false;
STAmount nonNative {A2["USD"](51)};
STAmount nonNative (A2["USD"](51));
sle->setFieldAmount (sfBalance, nonNative);
ac.view().update (sle);
return true;
@@ -366,7 +366,7 @@ class Invariants_test : public beast::unit_test::suite
return false;
auto sleNew = std::make_shared<SLE> (
keylet::escrow(A1, (*sle)[sfSequence] + 2));
STAmount nonNative {A2["USD"](51)};
STAmount nonNative (A2["USD"](51));
sleNew->setFieldAmount (sfAmount, nonNative);
ac.view().insert (sleNew);
return true;

View File

@@ -278,10 +278,10 @@ class PaymentSandbox_test : public beast::unit_test::suite
STAmount hugeAmt (issue, STAmount::cMaxValue, STAmount::cMaxOffset - 1,
false, false, STAmount::unchecked{});
for (auto timeDelta : {-env.closed ()->info ().closeTimeResolution,
env.closed ()->info ().closeTimeResolution})
for (auto d : {-1, 1})
{
auto const closeTime = fix1141Time () + timeDelta;
auto const closeTime = fix1141Time () +
d * env.closed()->info().closeTimeResolution;
env.close (closeTime);
ApplyViewImpl av (&*env.current (), tapNONE);
PaymentSandbox pv (&av);