-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0faf3bd
commit 7433107
Showing
7 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#ifndef WORKSPACETEST_H_ | ||
#define WORKSPACETEST_H_ | ||
|
||
#include <cxxtest/TestSuite.h> | ||
|
||
#include "MantidAPI/MatrixWorkspace.h" | ||
#include "MantidAPI/AnalysisDataService.h" | ||
|
||
using namespace Mantid::API; | ||
|
||
class WorkspaceTest : public CxxTest::TestSuite | ||
{ | ||
|
||
|
||
class Workspace1DTest: public Workspace | ||
{ | ||
public: | ||
const std::string id() const {return "Workspace1DTest";} | ||
virtual size_t getMemorySize() const {return 1;} | ||
}; | ||
|
||
public: | ||
|
||
void testSetTitle() | ||
{ | ||
Workspace1DTest ws; | ||
ws.setTitle("MyTitle"); | ||
TS_ASSERT_EQUALS( ws.getTitle(), "MyTitle"); | ||
|
||
ws.setTitle("New Title"); | ||
TS_ASSERT_EQUALS( ws.getTitle(), "New Title"); | ||
} | ||
|
||
void testSetComment() | ||
{ | ||
Workspace1DTest ws; | ||
ws.setComment("My comment"); | ||
TS_ASSERT_EQUALS( ws.getComment(), "My comment"); | ||
|
||
ws.setComment("My new comment"); | ||
TS_ASSERT_EQUALS( ws.getComment(), "My new comment"); | ||
} | ||
|
||
void test_copy_constructor() | ||
{ | ||
AnalysisDataService::Instance().add("workspace",Workspace_sptr( new Workspace1DTest() )); | ||
|
||
Workspace1DTest &ws = *AnalysisDataService::Instance().retrieveWS<Workspace1DTest>("workspace"); | ||
TS_ASSERT_EQUALS( ws.getName(), "workspace"); | ||
TS_ASSERT_EQUALS( ws.name(), "workspace"); | ||
ws.setTitle("Test workspace"); | ||
ws.setComment("Test comment"); | ||
|
||
Workspace1DTest ws1( ws ); | ||
TS_ASSERT_EQUALS( ws1.getTitle(), "Test workspace"); | ||
TS_ASSERT_EQUALS( ws1.getComment(), "Test comment"); | ||
TS_ASSERT_EQUALS( ws1.getName(), ""); | ||
TS_ASSERT_EQUALS( ws1.name(), ""); | ||
} | ||
|
||
}; | ||
|
||
#endif /*WORKSPACETEST_H_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters