From ea5a4635a1680c50669f9e6a94e45d9dc49743a8 Mon Sep 17 00:00:00 2001
From: Andrei Savici <saviciat@ornl.gov>
Date: Wed, 25 Jul 2012 18:29:55 -0400
Subject: [PATCH] MedianDetectorTest test for level up. Refs #5245

---
 .../Algorithms/test/MedianDetectorTestTest.h  | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h b/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h
index 0ebdb462295..3c1bfdbf888 100644
--- a/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h
@@ -133,6 +133,43 @@ public:
     TS_ASSERT_EQUALS(numFailed, 0);
   }
 
+  void testLevelsUp()
+  {
+      //load ARCS instrument, with all detectors 1
+      //With the solid angle correction turned on, and SignificanceTest = 0.01 should mask the short banks
+      //With the solid angle corection on, and LevelsUp=1, should be no failures
+      // Load the empty instrument
+      Mantid::DataHandling::LoadEmptyInstrument loader;
+      loader.initialize();
+      std::string inputFile = "ARCS_Definition.xml";
+      loader.setPropertyValue("Filename", inputFile);
+      loader.setPropertyValue("OutputWorkspace", "SolidAngle");
+      loader.execute();
+
+      MedianDetectorTest alg;
+      TS_ASSERT_THROWS_NOTHING(alg.initialize());
+      TS_ASSERT(alg.isInitialized());
+      // Set the properties
+      alg.setPropertyValue("InputWorkspace", "SolidAngle");
+      alg.setPropertyValue("OutputWorkspace","MedianDetectorTestOutput");
+      // set significance test to small
+      alg.setProperty("StartWorkspaceIndex",2);//no monitors
+      alg.setProperty("SignificanceTest", 0.01);
+      alg.setProperty("CorrectForSolidAngle",true);
+
+
+      TS_ASSERT_THROWS_NOTHING( alg.execute());
+      TS_ASSERT( alg.isExecuted() );
+      int numFailed = alg.getProperty("NumberOfFailures");
+      TS_ASSERT_EQUALS(numFailed, 2048);
+
+      alg.setProperty("LevelsUp","1");
+      TS_ASSERT_THROWS_NOTHING( alg.execute());
+      TS_ASSERT( alg.isExecuted() );
+      numFailed = alg.getProperty("NumberOfFailures");
+      TS_ASSERT_EQUALS(numFailed, 0);
+  }
+
   MedianDetectorTestTest() : m_IWSName("MedianDetectorTestInput")
   {
     using namespace Mantid;
-- 
GitLab