Skip to content
Snippets Groups Projects
Commit ee3d5338 authored by Samuel Jones's avatar Samuel Jones
Browse files

Re #22515 Start Unit test in cpp and rename files

parent 94c9559b
No related branches found
No related tags found
No related merge requests found
......@@ -280,7 +280,7 @@ set ( SRC_FILES
src/SofQWPolygon.cpp
src/SolidAngle.cpp
src/SortEvents.cpp
src/SortXAxis2.cpp
src/SortXAxis.cpp
src/SpatialGrouping.cpp
src/SpectrumAlgorithm.cpp
src/SpecularReflectionAlgorithm.cpp
......@@ -610,7 +610,7 @@ set ( INC_FILES
inc/MantidAlgorithms/SofQWPolygon.h
inc/MantidAlgorithms/SolidAngle.h
inc/MantidAlgorithms/SortEvents.h
inc/MantidAlgorithms/SortXAxis2.h
inc/MantidAlgorithms/SortXAxis.h
inc/MantidAlgorithms/SpatialGrouping.h
inc/MantidAlgorithms/SpectrumAlgorithm.h
inc/MantidAlgorithms/SpecularReflectionAlgorithm.h
......
#include "MantidAlgorithms/SortXAxis2.h"
#include "MantidAlgorithms/SortXAxis.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceProperty.h"
......@@ -16,7 +16,7 @@ DECLARE_ALGORITHM(SortXAxis)
const std::string SortXAxis::name() const { return "SortXAxis"; }
int SortXAxis::version() const { return 2; }
int SortXAxis::version() const { return 1; }
const std::string SortXAxis::category() const {
return "Transforms\\Axes;Utility\\Sorting";
......
#ifndef MANTID_ALGORITHMS_SORTXAXISTEST_H_
#define MANTID_ALGORITHMS_SORTXAXISTEST_H_
#include "MantidAlgorithms/SortXAxis.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidKernel/Workspace.h"
#include <cxxtest/TestSuite.h>
namespace {
MatrixWorkspace_sptr createWorkspace(const HistogramX &xData,
const HistogramY &yData,
const HistogramE &eData,
const int nSpec = 1) {
Workspace2D_sptr outWS = boost::make_shared<Workspace2D>();
outWS->initialize(nSpec, xData.size(), yData.size());
for (int i = 0; i < nSpec; ++i) {
outWS->mutableY(i) = yData;
outWS->mutableE(i) = eData;
outWS->mutableX(i) = xData;
}
outWS->getAxis(0)->unit() = UnitFactory::Instance().create("Wavelength");
return outWS;
}
class SortXAxisTest : public CxxTest::TestSuite {
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static SortXAxisTest *createSuite() { return new SortXAxisTest(); }
static void destroySuite(SortXAxisTest *suite) { delete suite; }
void testXAscending(){
std::vector<double> xData = {1,2,3};
std::vector<double> yData = {1,2,3};
std::vector<double> eData = {1,2,3};
MatrixWorkspace_sptr unsortedws = createWorkspace(xData, yData, eData);
SortXAxis alg;
alg.setProperty("InputWorkspacd", "unsortedws");
alg.setProperty("OutputWorkspace", "sortedws");
alg.execute();
MatrixWorkspace_sptr sortedws =
}
void testXDescending(){}
void testOnMultipleSpectrum(){}
void testSortsXHistogramAscending(){}
void testSortsXHistogramDescending(){}
void testSortXWorksChild(){}
void testDxMultipleSpectrum(){}
void testDxHistogramAscending(){}
void testSortDescending(){}
};
#endif /*MANTID_ALGORITHMS_SORTXAXISTEST_H_*/
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