Skip to content

Commit

Permalink
Re #12398 Test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Jun 15, 2015
1 parent 36ad474 commit e31aec8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ MATCHER_P3(FunctionParameter, param, value, delta, "")

MATCHER_P3(QwtDataX, i, value, delta, "") { return fabs(arg.x(i) - value) < delta; }
MATCHER_P3(QwtDataY, i, value, delta, "") { return fabs(arg.y(i) - value) < delta; }
MATCHER_P3(VectorValue, i, value, delta, "") { return fabs(arg.at(i) - value) < delta; }

class ALCBaselineModellingPresenterTest : public CxxTest::TestSuite
{
Expand Down Expand Up @@ -151,7 +152,9 @@ class ALCBaselineModellingPresenterTest : public CxxTest::TestSuite
EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size, 3),
QwtDataX(0, 1, 1E-8), QwtDataX(2, 3, 1E-8),
QwtDataY(0, 2, 1E-8), QwtDataY(2, 4, 1E-8)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0, 1, 1E-6),
VectorValue(2, 1, 1E-6))));

m_model->changeData();
}
Expand All @@ -163,7 +166,9 @@ class ALCBaselineModellingPresenterTest : public CxxTest::TestSuite
EXPECT_CALL(*m_view, setCorrectedCurve(AllOf(Property(&QwtData::size, 3),
QwtDataX(0, 1, 1E-8), QwtDataX(2, 3, 1E-8),
QwtDataY(0, 3, 1E-8), QwtDataY(2, 5, 1E-8)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0, 1, 1E-6),
VectorValue(2, 1, 1E-6))));

m_model->changeCorrectedData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class MockALCDataLoadingView : public IALCDataLoadingView

MATCHER_P3(QwtDataX, i, value, delta, "") { return fabs(arg.x(i) - value) < delta; }
MATCHER_P3(QwtDataY, i, value, delta, "") { return fabs(arg.y(i) - value) < delta; }
MATCHER_P3(VectorValue, i, value, delta, "") { return fabs(arg.at(i) - value) < delta; }

class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
{
Expand Down Expand Up @@ -124,7 +125,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 0.150, 1E-3),
QwtDataY(1, 0.143, 1E-3),
QwtDataY(2, 0.128, 1E-3)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,1.285E-3,1E-6),
VectorValue(1,1.284E-3,1E-6),
VectorValue(2,1.280E-3,1E-6))));

EXPECT_CALL(*m_view, restoreCursor());

Expand All @@ -140,7 +144,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 3.00349, 1E-3),
QwtDataY(1, 2.3779, 1E-3),
QwtDataY(2, 2.47935, 1E-3)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,0.539,1E-3),
VectorValue(1,0.535,1E-3),
VectorValue(2,0.541,1E-3))));

m_view->requestLoading();
}
Expand All @@ -154,7 +161,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 0.137, 1E-3),
QwtDataY(1, 0.141, 1E-3),
QwtDataY(2, 0.111, 1E-3)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,4.244E-3,1E-6),
VectorValue(1,4.243E-3,1E-6),
VectorValue(2,4.200E-3,1E-6))));

m_view->requestLoading();
}
Expand Down Expand Up @@ -220,7 +230,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 0.150616, 1E-3),
QwtDataY(1, 0.143444, 1E-3),
QwtDataY(2, 0.128856, 1E-3)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,1.282E-3,1E-6),
VectorValue(1,1.281E-3,1E-6),
VectorValue(2,1.277E-3,1E-6))));
m_view->requestLoading();
}

Expand Down Expand Up @@ -252,7 +265,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 0.150, 1E-3),
QwtDataY(1, 0.143, 1E-3),
QwtDataY(2, 0.128, 1E-3)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,1.285E-3,1E-6),
VectorValue(1,1.284E-3,1E-6),
VectorValue(2,1.280E-3,1E-6))));

m_view->requestLoading();
}
Expand All @@ -274,7 +290,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 0.012884, 1E-6),
QwtDataY(1, 0.022489, 1E-6),
QwtDataY(2, 0.038717, 1E-6)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,1.821E-3,1E-6),
VectorValue(1,1.821E-3,1E-6),
VectorValue(2,1.817E-3,1E-6))));
m_view->requestLoading();
}

Expand All @@ -289,7 +308,10 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite
QwtDataY(0, 0.15004, 1E-5),
QwtDataY(1, 0.14289, 1E-5),
QwtDataY(2, 0.12837, 1E-5)),
_));
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0,1.285E-3,1E-6),
VectorValue(1,1.284E-3,1E-6),
VectorValue(2,1.280E-3,1E-6))));
m_view->requestLoading();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class MockALCPeakFittingModel : public IALCPeakFittingModel

MATCHER_P3(QwtDataX, i, value, delta, "") { return fabs(arg.x(i) - value) < delta; }
MATCHER_P3(QwtDataY, i, value, delta, "") { return fabs(arg.y(i) - value) < delta; }
MATCHER_P3(VectorValue, i, value, delta, "") { return fabs(arg.at(i) - value) < delta; }

// DoubleNear matcher was introduced in gmock 1.7 only
MATCHER_P2(DoubleDelta, value, delta, "") { return fabs(arg - value) < delta; }
Expand Down Expand Up @@ -154,9 +155,17 @@ class ALCPeakFittingPresenterTest : public CxxTest::TestSuite

ON_CALL(*m_model, data()).WillByDefault(Return(ws));

// TODO: check better
EXPECT_CALL(*m_view, setDataCurve(_,_));

EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size, 3),
QwtDataX(0, 1, 1E-8),
QwtDataX(1, 1, 1E-8),
QwtDataX(2, 1, 1E-8),
QwtDataY(0, 2, 1E-8),
QwtDataY(1, 2, 1E-8),
QwtDataY(2, 2, 1E-8)),
AllOf(Property(&std::vector<double>::size,3),
VectorValue(0, 3, 1E-6),
VectorValue(1, 3, 1E-6),
VectorValue(2, 3, 1E-6))));
m_model->changeData();
}

Expand Down

0 comments on commit e31aec8

Please sign in to comment.