From adef8a5005c7ab24b463ca15eaf6144bbd5bf495 Mon Sep 17 00:00:00 2001
From: Gemma Guest <gemma.guest@stfc.ac.uk>
Date: Wed, 17 May 2017 19:53:28 +0100
Subject: [PATCH] Re #18829 Add unit test for invalid spectrum mapping

This tests an attempt to normalise by a transmission run with strict
spectrum checking enabled but where the requested spectrum does not
exist in the transmission run
---
 .../test/ReflectometryReductionOne2Test.h        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h
index 6710059b78a..4e7fde10250 100644
--- a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h
+++ b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h
@@ -288,6 +288,22 @@ public:
     TS_ASSERT_DELTA(outLam->y(0)[7], 0.08, 0.0001);
   }
 
+  void test_transmission_correction_with_bad_mapped_spectra() {
+    // Run workspace spectrum numbers are 1,2,3,4.
+    // Transmission workspace has spectrum numbers 2,3,4,5.
+    // Processing instructions 0 in the run workspace maps to
+    // spectrum 1, which doesn't exist in the transmission
+    // workspace.
+    ReflectometryReductionOne2 alg;
+    setupAlgorithm(alg, 1.5, 15.0, "0");
+    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");
+    TS_ASSERT_THROWS_ANYTHING(alg.execute());
+  }
+
   void test_exponential_correction() {
     // CorrectionAlgorithm: ExponentialCorrection
 
-- 
GitLab