Ignore:
Timestamp:
Jun 8, 2016, 10:45:27 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Children:
6369bc
Parents:
e34888
git-author:
Frederik Heber <heber@…> (06/06/16 14:28:05)
git-committer:
Frederik Heber <heber@…> (06/08/16 22:45:27)
Message:

Extended SamplingGridProperties::isCompatible() to allow more finely resolved grids, added ::isEquivalent().

  • isEquivalent contains the old check and we replaced isCompatible() by it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Summation/SetValues/unittests/SamplingGridPropertiesUnitTest.cpp

    re34888 rc739b3  
    7575}
    7676
    77 /** UnitTest for isCompatible()
     77/** UnitTest for isEquivalent()
    7878 */
    79 void SamplingGridPropertiesTest::isCompatible_Test()
     79void SamplingGridPropertiesTest::isEquivalent_Test()
    8080{
    8181  const double begin[3] = { 0., 0., 0. };
     
    9191
    9292  // only checks for same level
     93  CPPUNIT_ASSERT( props->isEquivalent(*props) );
     94  CPPUNIT_ASSERT( props->isEquivalent(sameprops) );
     95  CPPUNIT_ASSERT( sameprops.isEquivalent(*props) );
     96  CPPUNIT_ASSERT( !props->isEquivalent(otherprops) );
     97  CPPUNIT_ASSERT( !otherprops.isEquivalent(*props) );
     98  CPPUNIT_ASSERT( !props->isEquivalent(anotherprops) );
     99  CPPUNIT_ASSERT( !anotherprops.isEquivalent(*props) );
     100  CPPUNIT_ASSERT( !props->isEquivalent(moreotherprops) );
     101  CPPUNIT_ASSERT( !moreotherprops.isEquivalent(*props) );
     102}
     103
     104/** UnitTest for isCompatible()
     105 */
     106void SamplingGridPropertiesTest::isCompatible_Test()
     107{
     108  const double begin[3] = { 0., 0., 0. };
     109  const double otherbegin[3] = { .5, .5, .5 };
     110  const double end[3] = { 1., 1., 1. };
     111  const double otherend[3] = { 2., 2., 2. };
     112
     113  // create other props
     114  SamplingGridProperties sameprops(begin, end, 2); // same
     115  SamplingGridProperties secondhalf(otherbegin, end, 2); // second half
     116  SamplingGridProperties goingbeyond(begin, otherend, 2); // going beyond
     117  SamplingGridProperties finerlevel(begin, end, 4); // same but different level
     118
     119  // only checks for same level
    93120  CPPUNIT_ASSERT( props->isCompatible(*props) );
    94121  CPPUNIT_ASSERT( props->isCompatible(sameprops) );
    95122  CPPUNIT_ASSERT( sameprops.isCompatible(*props) );
    96   CPPUNIT_ASSERT( props->isCompatible(otherprops) );
    97   CPPUNIT_ASSERT( otherprops.isCompatible(*props) );
    98   CPPUNIT_ASSERT( props->isCompatible(anotherprops) );
    99   CPPUNIT_ASSERT( anotherprops.isCompatible(*props) );
    100   CPPUNIT_ASSERT( !props->isCompatible(moreotherprops) );
    101   CPPUNIT_ASSERT( !moreotherprops.isCompatible(*props) );
     123  CPPUNIT_ASSERT( props->isCompatible(secondhalf) );
     124  CPPUNIT_ASSERT( !secondhalf.isCompatible(*props) );
     125  CPPUNIT_ASSERT( !props->isCompatible(goingbeyond) );
     126  CPPUNIT_ASSERT( goingbeyond.isCompatible(*props) );
     127  CPPUNIT_ASSERT( props->isCompatible(finerlevel) );
     128  CPPUNIT_ASSERT( !finerlevel.isCompatible(*props) );
    102129}
    103130
Note: See TracChangeset for help on using the changeset viewer.