Skip to content
Snippets Groups Projects
Commit 9f464c2c authored by Nick Draper's avatar Nick Draper
Browse files

Add in testing of Result and Exectution states

parent 1d30456c
No related branches found
No related tags found
No related merge requests found
...@@ -152,6 +152,8 @@ public: ...@@ -152,6 +152,8 @@ public:
alg->setProperty("prop2", 17); alg->setProperty("prop2", 17);
TS_ASSERT_THROWS_NOTHING(alg->execute()); TS_ASSERT_THROWS_NOTHING(alg->execute());
TS_ASSERT(alg->isExecuted()); TS_ASSERT(alg->isExecuted());
TS_ASSERT_EQUALS(ExecutionState::Finished, alg->executionState());
TS_ASSERT_EQUALS(ResultState::Success, alg->resultState());
int out = alg->getProperty("out"); int out = alg->getProperty("out");
TS_ASSERT_EQUALS(out, 28); TS_ASSERT_EQUALS(out, 28);
} }
......
...@@ -291,11 +291,16 @@ public: ...@@ -291,11 +291,16 @@ public:
void testExecute() { void testExecute() {
ToyAlgorithm myAlg; ToyAlgorithm myAlg;
TS_ASSERT_EQUALS(ExecutionState::Uninitialized, myAlg.executionState());
TS_ASSERT_THROWS(myAlg.execute(), const std::runtime_error &); TS_ASSERT_THROWS(myAlg.execute(), const std::runtime_error &);
TS_ASSERT(!myAlg.isExecuted()); TS_ASSERT(!myAlg.isExecuted());
TS_ASSERT_EQUALS( ExecutionState::Uninitialized, myAlg.executionState());
TS_ASSERT_THROWS_NOTHING(myAlg.initialize()); TS_ASSERT_THROWS_NOTHING(myAlg.initialize());
TS_ASSERT_EQUALS(ExecutionState::Initialized, myAlg.executionState());
TS_ASSERT_THROWS_NOTHING(myAlg.execute()); TS_ASSERT_THROWS_NOTHING(myAlg.execute());
TS_ASSERT(myAlg.isExecuted()); TS_ASSERT(myAlg.isExecuted());
TS_ASSERT_EQUALS(ExecutionState::Finished, myAlg.executionState());
TS_ASSERT_EQUALS(ResultState::Success, myAlg.resultState());
} }
void testSetPropertyValue() { void testSetPropertyValue() {
...@@ -333,10 +338,14 @@ public: ...@@ -333,10 +338,14 @@ public:
alg.setProperty("PropertyB", 5); alg.setProperty("PropertyB", 5);
TS_ASSERT_THROWS_ANYTHING(alg.execute()); TS_ASSERT_THROWS_ANYTHING(alg.execute());
TS_ASSERT(!alg.isExecuted()); TS_ASSERT(!alg.isExecuted());
TS_ASSERT_EQUALS(ExecutionState::Finished, alg.executionState());
TS_ASSERT_EQUALS(ResultState::Failed, alg.resultState());
alg.setProperty("PropertyB", 15); alg.setProperty("PropertyB", 15);
TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted()); TS_ASSERT(alg.isExecuted());
TS_ASSERT_EQUALS(ExecutionState::Finished, alg.executionState());
TS_ASSERT_EQUALS(ResultState::Success, alg.resultState());
} }
void test_WorkspaceMethodFunctionsReturnEmptyByDefault() { void test_WorkspaceMethodFunctionsReturnEmptyByDefault() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment