Skip to content

Commit

Permalink
Re #5808. This should fix the bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Aug 28, 2012
1 parent 504579c commit 70836f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/src/MultiDomainFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace API
}
const CompositeDomain& cd = dynamic_cast<const CompositeDomain&>(domain);
// domain must not have less parts than m_maxIndex
if (cd.getNParts() < m_maxIndex)
if (cd.getNParts() <= m_maxIndex)
{
throw std::invalid_argument("CompositeDomain has too few parts ("
+ boost::lexical_cast<std::string>(cd.getNParts()) +
Expand Down
14 changes: 14 additions & 0 deletions Code/Mantid/Framework/API/test/MultiDomainFunctionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ class MultiDomainFunctionTest : public CxxTest::TestSuite

}

void test_set_wrong_index()
{
multi.setDomainIndices(1,std::vector<size_t>());
multi.setDomainIndices(2,std::vector<size_t>());

FunctionValues values(domain);

multi.setDomainIndex(0,3);
TS_ASSERT_THROWS( multi.function(domain,values), std::invalid_argument );

multi.setDomainIndex(0,4);
TS_ASSERT_THROWS( multi.function(domain,values), std::invalid_argument );
}

void test_calc()
{
multi.setDomainIndex(0,0);
Expand Down

0 comments on commit 70836f0

Please sign in to comment.