Newer
Older
#ifndef LOADILLTEST_H_
#define LOADILLTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidDataHandling/LoadILL.h"
#include "MantidAPI/AnalysisDataService.h"
using namespace Mantid::API;
class LoadILLTest: public CxxTest::TestSuite {
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
LoadILLTest() :
testFile("ILLIN5_094460.nxs") {
}
void testName() {
TS_ASSERT_EQUALS( loader.name(), "LoadILL");
}
void testVersion() {
TS_ASSERT_EQUALS( loader.version(), 1);
}
void testInit() {
TS_ASSERT_THROWS_NOTHING( loader.initialize());
TS_ASSERT( loader.isInitialized());
}
// void testFileCheck() {
// std::cerr << loader.fileCheck(testFile);
// }
void testExec() {
loader.setPropertyValue("Filename", testFile);
std::string outputSpace = "LoadILLTest_out";
loader.setPropertyValue("OutputWorkspace", outputSpace);
TS_ASSERT_THROWS_NOTHING( loader.execute());
// test workspace, copied from LoadMuonNexusTest.h
MatrixWorkspace_sptr output;
(output = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(
outputSpace));
MatrixWorkspace_sptr output2D = boost::dynamic_pointer_cast<
MatrixWorkspace>(output);
TS_ASSERT_EQUALS( output2D->getNumberHistograms(), 98304);
AnalysisDataService::Instance().clear();
}
Mantid::DataHandling::LoadILL loader;
std::string testFile;
};
//------------------------------------------------------------------------------
// Performance test
//------------------------------------------------------------------------------
class LoadILLTestPerformance: public CxxTest::TestSuite {
public:
void testDefaultLoad() {
Mantid::DataHandling::LoadILL loader;
loader.initialize();
loader.setPropertyValue("Filename", "ILLIN5_094460.nxs");
loader.setPropertyValue("OutputWorkspace", "ws");
TS_ASSERT( loader.execute());
}
};
#endif /*LoadILLTEST_H_*/