Skip to content

Commit

Permalink
Fix unit test compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bachase authored and nbougalis committed Aug 17, 2017
1 parent be1f734 commit a02a469
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
9 changes: 5 additions & 4 deletions src/test/app/Flow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
7 changes: 3 additions & 4 deletions src/test/app/Offer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,10 @@ class Offer_test : public beast::unit_test::suite
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
Expand Down
7 changes: 7 additions & 0 deletions src/test/beast/aged_associative_container_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ class aged_associative_container_test_base : public unit_test::suite
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*> (
Expand Down
4 changes: 2 additions & 2 deletions src/test/ledger/Invariants_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/test/ledger/PaymentSandbox_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a02a469

Please sign in to comment.