Skip to content

Commit

Permalink
Refs #5680 test_optionalWorkspace
Browse files Browse the repository at this point in the history
new file: LoadSassenaParamsTest.h
  • Loading branch information
jmborr committed Aug 22, 2012
1 parent a4801ae commit fb74722
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Code/Mantid/Framework/DataHandling/test/LoadSassenaParamsTest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef MANTID_DATAHANDLING_LOADSASSENAPARAMSTEST_H_
#define MANTID_DATAHANDLING_LOADSASSENAPARAMSTEST_H_

#include <cxxtest/TestSuite.h>
#include "MantidDataHandling/LoadSassenaParams.h"
#include "MantidAPI/AnalysisDataService.h"

using namespace Mantid;

class LOADSASSENAPARAMSTEST : public CxxTest::TestSuite
{
public:
static LOADSASSENAPARAMSTEST *createSuite() { return new LOADSASSENAPARAMSTEST(); }
static void destroySuite( LOADSASSENAPARAMSTEST *suite ) { delete suite; }

LOADSASSENAPARAMSTEST()
{
m_inputFile = "inputSassena_1.4.1.xml";
}

void test_init()
{
TS_ASSERT_THROWS_NOTHING( m_alg.initialize() )
TS_ASSERT( m_alg.isInitialized() )
}

void test_optionalWorkspace()
{
if( !m_alg.isInitialized() ) m_alg.initialize();
API::WorkspaceGroup_sptr gws = m_alg.getProperty("Workspace");
TS_ASSERT(!gws); //Check NULL pointer
gws = new API::WorkspaceGroup;
API::AnalysisDataService::Instance().add( "GWS", gws);
m_alg.setPropertyValue( "WorkSpace", "GWS" );
API::WorkspaceGroup_sptr gws2 = m_alg.getProperty("WorkSpace");
TS_ASSERT(gws==gws2);
}

void test_exec()
{
std::string result;
if( !m_alg.isInitialized() ) m_alg.initialize();
m_alg.setPropertyValue( "Filename", m_inputFile );
TS_ASSERT_THROWS_NOTHING( m_alg.execute() );
TS_ASSERT( m_alg.isExecuted() );

} // end of testExec

private:
std::string m_inputFile;
Mantid::DataHandling::LoadSassenaParams m_alg;

}; // end of class LOADSASSENAPARAMSTEST

#endif // MANTID_DATAHANDLING_LOADSASSENAPARAMSTEST_H_

0 comments on commit fb74722

Please sign in to comment.