Skip to content
Snippets Groups Projects
Commit 76e97bb7 authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #5633 #5634. Test via FunctionFactory

Quite a simple but important test, because these functions would not work via NormaliseByDetector unless they were factory registered. Also provides checking that they are types of IFunction, since the test downcasts the boost shared_ptr.
parent 713f964f
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "MantidCurveFitting/Jacobian.h" #include "MantidCurveFitting/Jacobian.h"
#include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionDomain1D.h"
#include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionValues.h"
#include "MantidAPI/FunctionFactory.h"
#include <algorithm> #include <algorithm>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
...@@ -114,12 +115,20 @@ public: ...@@ -114,12 +115,20 @@ public:
TS_ASSERT_EQUALS("ProductLinearExp", func.name()); TS_ASSERT_EQUALS("ProductLinearExp", func.name());
} }
void test_catagory() void test_category()
{ {
ProductLinearExp func; ProductLinearExp func;
TS_ASSERT_EQUALS("Calibrate", func.category()); TS_ASSERT_EQUALS("Calibrate", func.category());
} }
void test_registered_with_factory()
{
IFunction_sptr func = FunctionFactory::Instance().createFunction("ProductLinearExp");
TS_ASSERT(func != NULL);
TS_ASSERT_EQUALS(func->name(), "ProductLinearExp");
TS_ASSERT(boost::dynamic_pointer_cast<ProductLinearExp>(func) != NULL);
}
void test_set_parameters() void test_set_parameters()
{ {
const double A0 = 1; const double A0 = 1;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "MantidCurveFitting/Jacobian.h" #include "MantidCurveFitting/Jacobian.h"
#include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionDomain1D.h"
#include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionValues.h"
#include "MantidAPI/FunctionFactory.h"
#include <algorithm> #include <algorithm>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
...@@ -109,12 +110,20 @@ public: ...@@ -109,12 +110,20 @@ public:
TS_ASSERT_EQUALS("ProductQuadraticExp", func.name()); TS_ASSERT_EQUALS("ProductQuadraticExp", func.name());
} }
void test_catagory() void test_category()
{ {
ProductQuadraticExp func; ProductQuadraticExp func;
TS_ASSERT_EQUALS("Calibrate", func.category()); TS_ASSERT_EQUALS("Calibrate", func.category());
} }
void test_registered_with_factory()
{
IFunction_sptr func = FunctionFactory::Instance().createFunction("ProductQuadraticExp");
TS_ASSERT(func != NULL);
TS_ASSERT_EQUALS(func->name(), "ProductQuadraticExp");
TS_ASSERT(boost::dynamic_pointer_cast<ProductQuadraticExp>(func) != NULL);
}
void test_set_parameters() void test_set_parameters()
{ {
const double A0 = 1; const double A0 = 1;
......
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