LoadILLTest.h 3.37 KB
Newer Older
1
2
3
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4
5
//   NScD Oak Ridge National Laboratory, European Spallation Source,
//   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#pragma once
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include <cxxtest/TestSuite.h>

#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidDataHandling/Load.h"
#include "MantidKernel/ConfigService.h"

using Mantid::API::AnalysisDataService;
using Mantid::API::MatrixWorkspace_const_sptr;
using Mantid::DataHandling::Load;
using Mantid::Kernel::ConfigService;

class LoadILLTest : public CxxTest::TestSuite {
public:
  // This pair of boilerplate methods prevent the suite being created statically
  // This means the constructor isn't called when running other tests
  static LoadILLTest *createSuite() { return new LoadILLTest(); }
  static void destroySuite(LoadILLTest *suite) { delete suite; }

28
29
  void setUp() override {

30
    ConfigService::Instance().setString("default.facility", "ILL");
31
32
33
34
  }

  void tearDown() override {

35
    ConfigService::Instance().setString("default.facility", " ");
36
37
38

    AnalysisDataService::Instance().clear();
  }
39

David Fairbrother's avatar
David Fairbrother committed
40
  void checkLoader(const std::string &filename, std::string resultLoader) {
41
42
43
44
45
46
47
    Load alg;
    alg.setChild(true);
    alg.initialize();
    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Filename", filename))
    TS_ASSERT_EQUALS(alg.getPropertyValue("LoaderName"), resultLoader)
  }

48
  void test_LoadSANS_D11() { checkLoader("ILL/D11/010560", "LoadILLSANS"); }
49
50

  void test_LoadSANS_D33() {
51
52
    checkLoader("ILL/D33/002294", "LoadILLSANS");
    checkLoader("ILL/D33/042610", "LoadILLSANS"); // D33 TOF
53
54
  }

55
  void test_LoadSANS_D22() { checkLoader("ILL/D22/192068", "LoadILLSANS"); }
56

57
58
  void test_LoadSANS_D16() { checkLoader("ILL/D16/218356", "LoadILLSANS"); }

59
  void test_LoadDiffraction_D2B() {
60
    checkLoader("ILL/D2B/535401", "LoadILLDiffraction");
61
62
63
  }

  void test_LoadDiffraction_D20() {
64
65
    checkLoader("ILL/D20/967076", "LoadILLDiffraction");
    checkLoader("ILL/D20/967087", "LoadILLDiffraction");
66
67
68
  }

  void test_loadIndirect_IN16B() {
69
70
71
72
73
74
75
    checkLoader("ILL/IN16B/090661", "LoadILLIndirect"); // one wing qens
    checkLoader("ILL/IN16B/083072", "LoadILLIndirect"); // one wing efws
    checkLoader("ILL/IN16B/083073", "LoadILLIndirect"); // one wing ifws
    checkLoader("ILL/IN16B/136558", "LoadILLIndirect"); // two wings qens
    checkLoader("ILL/IN16B/143720", "LoadILLIndirect"); // two wings efws
    checkLoader("ILL/IN16B/170300", "LoadILLIndirect"); // two wings ifws
    checkLoader("ILL/IN16B/215962", "LoadILLIndirect"); // bats
76
77
  }

78
  void test_loadTOF_IN4() { checkLoader("ILL/IN4/084446", "LoadILLTOF"); }
79
80

  void test_loadTOF_IN5() {
81
82
    checkLoader("ILL/IN5/104007", "LoadILLTOF");
    checkLoader("ILL/IN5/189171", "LoadILLTOF");
83
84
85
  }

  void test_loadTOF_IN6() {
86
87
    checkLoader("ILL/IN6/164192", "LoadILLTOF");
    checkLoader("ILL/IN6/220010", "LoadILLTOF");
88
89
90
  }

  void test_loadTOF_PANTHER() {
91
92
    checkLoader("ILL/PANTHER/001036", "LoadILLTOF"); // monochromatic PANTHER
    checkLoader("ILL/PANTHER/001723", "LoadILLTOF");
93
94
95
  }

  void test_loadReflectometry_D17() {
96
    checkLoader("ILL/D17/317370", "LoadILLReflectometry");
97
98
99
  }

  void test_loadReflectometry_FIGARO() {
100
    checkLoader("ILL/Figaro/000002", "LoadILLReflectometry");
101
102
  }
};