From 9f464c2c2b69c387b60fb0c1e85e7a7572842985 Mon Sep 17 00:00:00 2001
From: Nick Draper <nick.draper@stfc.ac.uk>
Date: Fri, 6 Mar 2020 16:08:55 +0000
Subject: [PATCH] Add in testing of Result and Exectution states

---
 Framework/API/test/AlgorithmProxyTest.h | 2 ++
 Framework/API/test/AlgorithmTest.h      | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/Framework/API/test/AlgorithmProxyTest.h b/Framework/API/test/AlgorithmProxyTest.h
index 4d1f07756b5..56157c71ca8 100644
--- a/Framework/API/test/AlgorithmProxyTest.h
+++ b/Framework/API/test/AlgorithmProxyTest.h
@@ -152,6 +152,8 @@ public:
     alg->setProperty("prop2", 17);
     TS_ASSERT_THROWS_NOTHING(alg->execute());
     TS_ASSERT(alg->isExecuted());
+    TS_ASSERT_EQUALS(ExecutionState::Finished, alg->executionState());
+    TS_ASSERT_EQUALS(ResultState::Success, alg->resultState());
     int out = alg->getProperty("out");
     TS_ASSERT_EQUALS(out, 28);
   }
diff --git a/Framework/API/test/AlgorithmTest.h b/Framework/API/test/AlgorithmTest.h
index 7b5a07cff92..7ba16807349 100644
--- a/Framework/API/test/AlgorithmTest.h
+++ b/Framework/API/test/AlgorithmTest.h
@@ -291,11 +291,16 @@ public:
 
   void testExecute() {
     ToyAlgorithm myAlg;
+    TS_ASSERT_EQUALS(ExecutionState::Uninitialized, myAlg.executionState());
     TS_ASSERT_THROWS(myAlg.execute(), const std::runtime_error &);
     TS_ASSERT(!myAlg.isExecuted());
+    TS_ASSERT_EQUALS( ExecutionState::Uninitialized, myAlg.executionState());
     TS_ASSERT_THROWS_NOTHING(myAlg.initialize());
+    TS_ASSERT_EQUALS(ExecutionState::Initialized, myAlg.executionState());
     TS_ASSERT_THROWS_NOTHING(myAlg.execute());
     TS_ASSERT(myAlg.isExecuted());
+    TS_ASSERT_EQUALS(ExecutionState::Finished, myAlg.executionState());
+    TS_ASSERT_EQUALS(ResultState::Success, myAlg.resultState());
   }
 
   void testSetPropertyValue() {
@@ -333,10 +338,14 @@ public:
     alg.setProperty("PropertyB", 5);
     TS_ASSERT_THROWS_ANYTHING(alg.execute());
     TS_ASSERT(!alg.isExecuted());
+    TS_ASSERT_EQUALS(ExecutionState::Finished, alg.executionState());
+    TS_ASSERT_EQUALS(ResultState::Failed, alg.resultState());
 
     alg.setProperty("PropertyB", 15);
     TS_ASSERT_THROWS_NOTHING(alg.execute());
     TS_ASSERT(alg.isExecuted());
+    TS_ASSERT_EQUALS(ExecutionState::Finished, alg.executionState());
+    TS_ASSERT_EQUALS(ResultState::Success, alg.resultState());
   }
 
   void test_WorkspaceMethodFunctionsReturnEmptyByDefault() {
-- 
GitLab