Commit 16dd9e1c authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Fix warnings. clang-format.

parent 67bee711
...@@ -77,7 +77,8 @@ void HistoryView::unroll(std::vector<HistoryItem>::iterator &it) { ...@@ -77,7 +77,8 @@ void HistoryView::unroll(std::vector<HistoryItem>::iterator &it) {
// workaround for GCC < 4.9 // workaround for GCC < 4.9
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55817 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55817
++it; ++it;
for(auto itItem = tmpHistory.rbegin();itItem!=tmpHistory.rend();++itItem){ for (auto itItem = tmpHistory.rbegin(); itItem != tmpHistory.rend();
++itItem) {
it = m_historyItems.insert(it, *itItem); it = m_historyItems.insert(it, *itItem);
} }
#endif #endif
......
...@@ -352,13 +352,15 @@ public: ...@@ -352,13 +352,15 @@ public:
}; };
class HistoryViewTestPerformance : public CxxTest::TestSuite { class HistoryViewTestPerformance : public CxxTest::TestSuite {
public: public:
// This pair of boilerplate methods prevent the suite being created statically // This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests // This means the constructor isn't called when running other tests
static HistoryViewTestPerformance *createSuite() { return new HistoryViewTestPerformance(); } static HistoryViewTestPerformance *createSuite() {
return new HistoryViewTestPerformance();
}
static void destroySuite(HistoryViewTestPerformance *suite) { delete suite; } static void destroySuite(HistoryViewTestPerformance *suite) { delete suite; }
private: private:
// 'Empty' algorithm class for tests // 'Empty' algorithm class for tests
class testalg : public Algorithm { class testalg : public Algorithm {
...@@ -377,12 +379,12 @@ private: ...@@ -377,12 +379,12 @@ private:
const std::string category() const { const std::string category() const {
return "Cat"; return "Cat";
} ///< Algorithm's category for identification } ///< Algorithm's category for identification
void init() { declareProperty("name", "", Direction::Input); } void init() { declareProperty("name", "", Direction::Input); }
void exec() {} void exec() {}
}; };
private: private:
AlgorithmHistory_sptr AlgorithmHistory_sptr
createFromTestAlg(const std::string &name, createFromTestAlg(const std::string &name,
...@@ -391,24 +393,27 @@ private: ...@@ -391,24 +393,27 @@ private:
alg.initialize(); alg.initialize();
alg.setPropertyValue("name", name); alg.setPropertyValue("name", name);
alg.execute(); alg.execute();
AlgorithmHistory history(&alg, execTime, 14.0, m_execCount++); AlgorithmHistory history(&alg, execTime, 14.0, m_execCount++);
return boost::make_shared<AlgorithmHistory>(history); return boost::make_shared<AlgorithmHistory>(history);
} }
public: public:
HistoryViewTestPerformance() : m_wsHist(), m_execCount(0) { HistoryViewTestPerformance() : m_wsHist(), m_execCount(0) {
// create dummy history structure // create dummy history structure
for(std::size_t i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i) {
{ auto alg = createFromTestAlg("alg" + boost::lexical_cast<std::string>(i),
auto alg = createFromTestAlg("alg"+boost::lexical_cast<std::string>(i), DateAndTime(100+i, 0)); DateAndTime(100 + i, 0));
for(std::size_t j = 0; j < 20; ++j) for (int j = 0; j < 20; ++j) {
{ auto childAlg =
auto childAlg = createFromTestAlg("child"+boost::lexical_cast<std::string>(j), DateAndTime(200+j, 0)); createFromTestAlg("child" + boost::lexical_cast<std::string>(j),
for (std::size_t k = 0; k < 20; ++k) DateAndTime(200 + j, 0));
{ for (int k = 0; k < 20; ++k) {
auto subChildAlg = createFromTestAlg("subChild"+boost::lexical_cast<std::string>(j)+boost::lexical_cast<std::string>(k), DateAndTime(300+k, 0)); auto subChildAlg = createFromTestAlg(
"subChild" + boost::lexical_cast<std::string>(j) +
boost::lexical_cast<std::string>(k),
DateAndTime(300 + k, 0));
childAlg->addChildHistory(subChildAlg); childAlg->addChildHistory(subChildAlg);
} }
alg->addChildHistory(childAlg); alg->addChildHistory(childAlg);
...@@ -416,20 +421,18 @@ public: ...@@ -416,20 +421,18 @@ public:
m_wsHist.addHistory(alg); m_wsHist.addHistory(alg);
} }
} }
void test_UnrollAll() { void test_UnrollAll() {
HistoryView view(m_wsHist); HistoryView view(m_wsHist);
TS_ASSERT_THROWS_NOTHING(view.unrollAll()); TS_ASSERT_THROWS_NOTHING(view.unrollAll());
} }
void test_UnrollAllRollAll() { void test_UnrollAllRollAll() {
HistoryView view(m_wsHist); HistoryView view(m_wsHist);
TS_ASSERT_THROWS_NOTHING(view.unrollAll()); TS_ASSERT_THROWS_NOTHING(view.unrollAll());
TS_ASSERT_THROWS_NOTHING(view.rollAll()); TS_ASSERT_THROWS_NOTHING(view.rollAll());
} }
WorkspaceHistory m_wsHist; WorkspaceHistory m_wsHist;
size_t m_execCount; size_t m_execCount;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment