From 7b1d0d87e69607e35ae906cf9da94acae151cd5b Mon Sep 17 00:00:00 2001
From: Gemma Guest <gemma.guest@stfc.ac.uk>
Date: Thu, 18 May 2017 09:24:10 +0100
Subject: [PATCH] Re #18829 Add unit test for StrictSpectrumChecking=false

This adds a unit test for a case where spectrum numbers are different in
the transmission and run workspaces, but mapping between them is not
done because StrictSpectrumChecking is set to false.
---
 .../test/ReflectometryReductionOne2Test.h     | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h
index 4e7fde10250..a160edecda4 100644
--- a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h
+++ b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h
@@ -304,6 +304,26 @@ public:
     TS_ASSERT_THROWS_ANYTHING(alg.execute());
   }
 
+  void test_transmission_correction_with_different_spectra() {
+    // Run workspace spectrum numbers are 1,2,3,4.  Transmission workspace has
+    // spectrum numbers 2,3,4,5.  Processing instructions 2,3 are used in the
+    // run and transmission workspaces without any mapping i.e. spectra 3-4 in
+    // the run and spectra 4-5 in the transmission workspace are used.
+    ReflectometryReductionOne2 alg;
+    setupAlgorithm(alg, 1.5, 15.0, "2-3");
+    alg.setProperty("FirstTransmissionRun", m_transmissionWS);
+    alg.setProperty("SecondTransmissionRun", m_transmissionWS);
+    alg.setProperty("StartOverlap", 2.5);
+    alg.setProperty("EndOverlap", 3.0);
+    alg.setProperty("Params", "0.1");
+    alg.setProperty("StrictSpectrumChecking", "0");
+    MatrixWorkspace_sptr outLam = runAlgorithmLam(alg);
+
+    // Expected values are 1 = m_wavelength / m_wavelength
+    TS_ASSERT_DELTA(outLam->y(0)[0], 0.0571, 0.0001);
+    TS_ASSERT_DELTA(outLam->y(0)[7], 0.0571, 0.0001);
+  }
+
   void test_exponential_correction() {
     // CorrectionAlgorithm: ExponentialCorrection
 
-- 
GitLab