Newer
Older
Janik Zikovsky
committed
#ifndef MANTID_KERNEL_PROGRESSTEXTTEST_H_
#define MANTID_KERNEL_PROGRESSTEXTTEST_H_
Janik Zikovsky
committed
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
#include "MantidKernel/System.h"
#include <cstdlib>
Janik Zikovsky
committed
#include "MantidKernel/ProgressText.h"
Janik Zikovsky
committed
Janik Zikovsky
committed
using namespace Mantid::Kernel;
Janik Zikovsky
committed
class ProgressTextTest : public CxxTest::TestSuite {
Janik Zikovsky
committed
public:
Janik Zikovsky
committed
ProgressText p(0.5, 1.0, 10);
TS_ASSERT_THROWS_NOTHING(p.setNumSteps(100));
}
TS_ASSERT_THROWS_NOTHING(ProgressText(0.0, 1.0, 0););
TS_ASSERT_THROWS_NOTHING(ProgressText(0.0, 1.0, 2, true););
Janik Zikovsky
committed
ProgressText p(0.5, 1.0, 10);
// 4 outputs
p.report();
p.report("I have an optional message");
p.report();
p.report();
p.setNumSteps(100);
// These should output only 2 lines. The % will go backwards though
p.report();
p.report();
p.report();
p.report();
p.setNumSteps(5);
p.report();
}
ProgressText p(0.0, 1.0, 100, false);
std::string msg = "";
for (int i = 0; i < std::rand() % 10; i++)
msg += "bla";
p.report(msg);
}
}
Janik Zikovsky
committed
};