Skip to content

Commit

Permalink
Added additional tests. Refs #9026.
Browse files Browse the repository at this point in the history
- Removed forward declaration from catalog interface to allow creation and assignment of `CatalogSearchParam`.
- Had to add `DLLExport` to `CatalogSearchParam` to prevent linker issues.
- Removed `CatalogSearchParam` include from catalogs as it is now in the inherited interface.
  • Loading branch information
jawrainey committed Feb 20, 2014
1 parent e6af916 commit 0a6469d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
7 changes: 1 addition & 6 deletions Code/Mantid/Framework/API/inc/MantidAPI/ICatalog.h
@@ -1,16 +1,11 @@
#ifndef MANTID_API_ICATLOG_H_
#define MANTID_API_ICATLOG_H_
#include "MantidAPI/ITableWorkspace.h"
#include "MantidICat/CatalogSearchParam.h"

namespace Mantid
{

//forward declarations
namespace ICat
{
class CatalogSearchParam;
}

namespace API
{

Expand Down
Expand Up @@ -31,7 +31,7 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class CatalogSearchParam
class DLLExport CatalogSearchParam
{
public:
/// constructor
Expand Down
Expand Up @@ -2,7 +2,6 @@
#define MANTID_ICAT_ICAT3CATALOG_H_

#include "MantidAPI/ICatalog.h"
#include "MantidICat/CatalogSearchParam.h"
#include "MantidICat/ICat3/ICat3ErrorHandling.h"
#include "MantidICat/ICat3/ICat3Helper.h"

Expand Down
Expand Up @@ -4,7 +4,6 @@
#include "MantidAPI/ICatalog.h"
#include "MantidAPI/TableRow.h"
#include "MantidKernel/Logger.h"
#include "MantidICat/CatalogSearchParam.h"

namespace Mantid
{
Expand Down
36 changes: 35 additions & 1 deletion Code/Mantid/Framework/ICat/test/CompositeCatalogTest.h
Expand Up @@ -3,7 +3,6 @@

#include <cxxtest/TestSuite.h>

#include "MantidICat/CatalogSearchParam.h"
#include "MantidICat/CompositeCatalog.h"

#include <boost/make_shared.hpp>
Expand Down Expand Up @@ -136,6 +135,41 @@ class CompositeCatalogTest : public CxxTest::TestSuite
delete compositeCatalog;
}

void testSearch()
{
CompositeCatalog* compositeCatalog = new CompositeCatalog();
DummyCatalog::m_counter = 0;

compositeCatalog->add(boost::make_shared<DummyCatalog>());
compositeCatalog->add(boost::make_shared<DummyCatalog>());

CatalogSearchParam params;
ITableWorkspace_sptr ws;
int limit = 0;
int offset = 0;
compositeCatalog->search(params,ws,offset,limit);

TS_ASSERT_EQUALS(DummyCatalog::m_counter,2);

delete compositeCatalog;
}

void testGetNumberOfSearchResults()
{
CompositeCatalog* compositeCatalog = new CompositeCatalog();
DummyCatalog::m_counter = 0;

compositeCatalog->add(boost::make_shared<DummyCatalog>());
compositeCatalog->add(boost::make_shared<DummyCatalog>());

CatalogSearchParam params;
compositeCatalog->getNumberOfSearchResults(params);

TS_ASSERT_EQUALS(DummyCatalog::m_counter,2);

delete compositeCatalog;
}

void testMyData()
{
CompositeCatalog* compositeCatalog = new CompositeCatalog();
Expand Down

0 comments on commit 0a6469d

Please sign in to comment.