Newer
Older
Janik Zikovsky
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef MANTID_API_PROGRESSTEXTTEST_H_
#define MANTID_API_PROGRESSTEXTTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
#include "MantidKernel/System.h"
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include "MantidAPI/ProgressText.h"
using namespace Mantid::API;
class ProgressTextTest : public CxxTest::TestSuite
{
public:
void test_setNumSteps()
{
ProgressText p(0.5, 1.0, 10);
TS_ASSERT_THROWS_NOTHING(p.setNumSteps(100));
}
/// Disabled because it has text output
void xtest_with_stdout()
{
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();
}
// /// Disabled because it has text output
// void test_on_one_line()
// {
// ProgressText p(0.0, 1.0, 100, false);
// for (int i=0; i<100; i++)
// {
// std::string msg = "";
// for (int i = 0; i < std::rand() %10; i++)
// msg += "bla";
// p.report(msg);
// usleep(10000);
// }
// }
};
#endif /* MANTID_API_PROGRESSTEXTTEST_H_ */