Added Dimension::equal() method.
This commit is contained in:
@@ -56,6 +56,15 @@ namespace Opm {
|
||||
return dimension;
|
||||
}
|
||||
|
||||
|
||||
bool Dimension::equal(const Dimension& other) {
|
||||
if ((m_name == other.m_name) &&
|
||||
(m_SIfactor == other.m_SIfactor))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Opm {
|
||||
public:
|
||||
Dimension(const std::string& name, double SI_factor);
|
||||
double getSIScaling() const;
|
||||
bool equal(const Dimension& other);
|
||||
const std::string& getName() const;
|
||||
static Dimension * newComposite(const std::string& dim , double SIfactor);
|
||||
|
||||
|
||||
@@ -155,4 +155,16 @@ BOOST_AUTO_TEST_CASE(CreateUnitMap) {
|
||||
BOOST_CHECK_THROW( systemMap.getSystem( "NoNotThisOne") , std::invalid_argument);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DimensionEqual) {
|
||||
Dimension d1("L" , 1);
|
||||
Dimension d2("L" , 1);
|
||||
Dimension d3("t" , 1);
|
||||
Dimension d4("L" , 2);
|
||||
|
||||
BOOST_CHECK_EQUAL( true , d1.equal(d1) );
|
||||
BOOST_CHECK_EQUAL( true , d1.equal(d2) );
|
||||
BOOST_CHECK_EQUAL( false , d1.equal(d3) );
|
||||
BOOST_CHECK_EQUAL( false , d1.equal(d4) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user