forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeltaEModeTest.h
48 lines (39 loc) · 2 KB
/
DeltaEModeTest.h
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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidKernel/DeltaEMode.h"
#include <cxxtest/TestSuite.h>
using Mantid::Kernel::DeltaEMode;
class DeltaEModeTest : 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 DeltaEModeTest *createSuite() { return new DeltaEModeTest(); }
static void destroySuite(DeltaEModeTest *suite) { delete suite; }
DeltaEModeTest() : m_elasticString("Elastic"), m_directString("Direct"), m_indirectString("Indirect") {}
void test_availableTypes_Are_The_3_Expected_In_The_Correct_Order() {
const std::vector<std::string> modes = DeltaEMode::availableTypes();
TS_ASSERT_EQUALS(modes.size(), 3);
TS_ASSERT_EQUALS(modes[0], m_elasticString);
TS_ASSERT_EQUALS(modes[1], m_directString);
TS_ASSERT_EQUALS(modes[2], m_indirectString);
}
void test_elastic_mode_is_correctly_transformed_to_and_from_string() {
TS_ASSERT_EQUALS(DeltaEMode::asString(DeltaEMode::Elastic), m_elasticString);
TS_ASSERT_EQUALS(DeltaEMode::fromString(m_elasticString), DeltaEMode::Elastic);
}
void test_direct_mode_is_correctly_transformed_to_and_from_string() {
TS_ASSERT_EQUALS(DeltaEMode::asString(DeltaEMode::Direct), m_directString);
TS_ASSERT_EQUALS(DeltaEMode::fromString(m_elasticString), DeltaEMode::Elastic);
}
void test_indirect_mode_is_correctly_transformed_to_and_from_string() {
TS_ASSERT_EQUALS(DeltaEMode::asString(DeltaEMode::Indirect), m_indirectString);
TS_ASSERT_EQUALS(DeltaEMode::fromString(m_elasticString), DeltaEMode::Elastic);
}
private:
const std::string m_elasticString, m_directString, m_indirectString;
};