Skip to content

Commit

Permalink
Updated unit test to verify ScriptText is correct. Refs #8599.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Dec 13, 2013
1 parent 5a126c0 commit ec75e47
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -52,21 +52,26 @@ class GeneratePythonScriptTest : public CxxTest::TestSuite
TS_ASSERT( alg.isInitialized() );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InputWorkspace", workspaceName) );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Filename", "GeneratePythonScriptTest.py") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("ScriptText", "") );
TS_ASSERT_THROWS_NOTHING( alg.execute(); );
TS_ASSERT( alg.isExecuted() );


// Compare the contents of the file to the expected result line-by-line.
std::string filename = alg.getProperty("Filename");
std::ifstream file(filename.c_str(), std::ifstream::in);
std::string scriptLine;
int lineCount(0);

while(std::getline(file, scriptLine))
{
TS_ASSERT_EQUALS(scriptLine,result[lineCount]);
lineCount++;
}

// Verify that if we set the content of ScriptText that it is set correctly.
alg.setPropertyValue("ScriptText", result[4]);
TS_ASSERT_EQUALS(alg.getPropertyValue("ScriptText"), "CropWorkspace(InputWorkspace='testGeneratePython',OutputWorkspace='testGeneratePython',XMin='2',XMax='5')");

file.close();
if (Poco::File(filename).exists()) Poco::File(filename).remove();
}
Expand Down

0 comments on commit ec75e47

Please sign in to comment.