From 08db204c3c3ba8f5aa6108a9668534c369f582e8 Mon Sep 17 00:00:00 2001 From: Conor Finn Date: Tue, 16 Apr 2024 14:44:11 +0100 Subject: [PATCH] Add initial testing class RE #36144 --- Framework/Algorithms/CMakeLists.txt | 1 + .../FlipperEfficiency.cpp | 2 +- .../DepolarizedAnalyserTransmissionTest.h | 1 + .../FlipperEfficiencyTest.h | 34 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Framework/Algorithms/test/PolarizationCorrections/FlipperEfficiencyTest.h diff --git a/Framework/Algorithms/CMakeLists.txt b/Framework/Algorithms/CMakeLists.txt index 2509b0cec33a..fca615eb15e4 100644 --- a/Framework/Algorithms/CMakeLists.txt +++ b/Framework/Algorithms/CMakeLists.txt @@ -948,6 +948,7 @@ set(TEST_FILES PolarizationCorrections/HeliumAnalyserEfficiencyTest.h PolarizationCorrections/PolarizationCorrectionsHelpersTest.h PolarizationCorrections/SpinStateValidatorTest.h + PolarizationCorrections/FlipperEfficiencyTest.h PolarizationCorrectionFredrikzeTest.h PolarizationCorrectionWildesTest.h PolarizationEfficiencyCorTest.h diff --git a/Framework/Algorithms/src/PolarizationCorrections/FlipperEfficiency.cpp b/Framework/Algorithms/src/PolarizationCorrections/FlipperEfficiency.cpp index 9cec689170e8..41271b358235 100644 --- a/Framework/Algorithms/src/PolarizationCorrections/FlipperEfficiency.cpp +++ b/Framework/Algorithms/src/PolarizationCorrections/FlipperEfficiency.cpp @@ -19,7 +19,7 @@ using namespace Kernel; // Register the algorithm in the AlgorithmFactory DECLARE_ALGORITHM(FlipperEfficiency) -std::string const FlipperEfficiency::summary() const {} +std::string const FlipperEfficiency::summary() const { return "Calculate the efficiency of the polarization flipper."; } void FlipperEfficiency::init() {} diff --git a/Framework/Algorithms/test/PolarizationCorrections/DepolarizedAnalyserTransmissionTest.h b/Framework/Algorithms/test/PolarizationCorrections/DepolarizedAnalyserTransmissionTest.h index a7d139d5328f..c0e24b4ba59b 100644 --- a/Framework/Algorithms/test/PolarizationCorrections/DepolarizedAnalyserTransmissionTest.h +++ b/Framework/Algorithms/test/PolarizationCorrections/DepolarizedAnalyserTransmissionTest.h @@ -143,6 +143,7 @@ class DepolarizedAnalyserTransmissionTest : public CxxTest::TestSuite { TS_ASSERT_THROWS_EQUALS(alg->execute(), std::runtime_error const &e, std::string(e.what()), "Failed to fit to transmission workspace, : Fit quality (chi-squared) is too poor " "(0.000000. Should be 0 < x < 1). You may want to check that the correct spectrum " + "and starting fitting values were provided."); TS_ASSERT(!alg->isExecuted()); } diff --git a/Framework/Algorithms/test/PolarizationCorrections/FlipperEfficiencyTest.h b/Framework/Algorithms/test/PolarizationCorrections/FlipperEfficiencyTest.h new file mode 100644 index 000000000000..be85bcc7a0ca --- /dev/null +++ b/Framework/Algorithms/test/PolarizationCorrections/FlipperEfficiencyTest.h @@ -0,0 +1,34 @@ +// Mantid Repository : https://github.com/mantidproject/mantid +// +// Copyright © 2024 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 + +#include "MantidAlgorithms/CreateSampleWorkspace.h" +#include "MantidAlgorithms/PolarizationCorrections/FlipperEfficiency.h" + +namespace {} // namespace + +using Mantid::Algorithms::FlipperEfficiency; + +class FlipperEfficiencyTest : public CxxTest::TestSuite { +public: + void test_name() { + FlipperEfficiency const alg; + TS_ASSERT_EQUALS(alg.name(), "FlipperEfficiency"); + } + + void test_version() { + FlipperEfficiency const alg; + TS_ASSERT_EQUALS(alg.version(), 1); + } + + void test_category() { + FlipperEfficiency const alg; + TS_ASSERT_EQUALS(alg.category(), "SANS\\PolarizationCorrections"); + } +};