- Timestamp:
- Jun 8, 2016, 10:45:27 PM (9 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SetValues/unittests/SamplingGridUnitTest.cpp
re34888 rc739b3 89 89 } 90 90 91 /** UnitTest on compatiblecombination of props and values92 */ 93 void SamplingGridTest:: compatibleGrids_Test()91 /** UnitTest on equivalent combination of props and values 92 */ 93 void SamplingGridTest::equivalentGrids_Test() 94 94 { 95 95 // check illegal grid 96 96 const double begin[NDIM] = { 0., 0., 0. }; 97 const double end[NDIM] = { 2., 2., 2. };97 const double end[NDIM] = { 1., 1., 1. }; 98 98 SamplingGridProperties illegal_props(begin, end, 5); 99 99 SamplingGridProperties legal_props(begin, end, 2); 100 CPPUNIT_ASSERT( !grid->isEquivalent(illegal_props) ); 101 CPPUNIT_ASSERT( grid->isEquivalent(legal_props) ); 102 SamplingGrid::sampledvalues_t illegal_values; 103 for (size_t i=0; i< NUMBEROFSAMPLES(1); ++i) 104 illegal_values += 1.5; 105 SamplingGrid::sampledvalues_t legal_values; 106 for (size_t i=0; i< NUMBEROFSAMPLES(2); ++i) 107 legal_values += 1.5; 108 #ifndef NDEBUG 109 // throws because props and size of illegal_values don't match 110 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 111 CPPUNIT_ASSERT_THROW( SamplingGrid illegal_grid(illegal_props, illegal_values), Assert::AssertionFailure ); 112 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 113 CPPUNIT_ASSERT_THROW( SamplingGrid illegal_grid(legal_props, illegal_values), Assert::AssertionFailure ); 114 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 115 CPPUNIT_ASSERT_THROW( SamplingGrid illegal_grid(illegal_props, legal_values), Assert::AssertionFailure ); 116 #endif 117 // check that grid is still the same 118 for (SamplingGrid::sampledvalues_t::const_iterator iter = grid->sampled_grid.begin(); 119 iter != grid->sampled_grid.end(); ++iter) 120 CPPUNIT_ASSERT_EQUAL( grid_value, *iter ); 121 } 122 123 /** UnitTest on compatible combination of props and values 124 */ 125 void SamplingGridTest::compatibleGrids_Test() 126 { 127 // check illegal grid 128 const double begin[NDIM] = { 0., 0., 0. }; 129 const double end[NDIM] = { 1., 1., 1. }; 130 const double otherend[NDIM] = { 2.5, 2.5, 2.5 }; 131 SamplingGridProperties illegal_props(begin, otherend, 5); 132 SamplingGridProperties legal_props(begin, end, 3); 100 133 CPPUNIT_ASSERT( !grid->isCompatible(illegal_props) ); 101 134 CPPUNIT_ASSERT( grid->isCompatible(legal_props) ); … … 143 176 SamplingGrid default_grid(legal_props); 144 177 // note that we always construct a temporary SamplingGrid from given props 145 CPPUNIT_ASSERT( default_grid.is Compatible(illegal_begin_props) == default_grid.isCongruent(illegal_begin_props));146 CPPUNIT_ASSERT( default_grid.is Compatible(illegal_end_props) == default_grid.isCongruent(illegal_end_props));147 CPPUNIT_ASSERT( default_grid.is Compatible(illegal_level_props) == default_grid.isCongruent(illegal_level_props));148 CPPUNIT_ASSERT( default_grid.is Compatible(legal_props) == default_grid.isCongruent(legal_props) );178 CPPUNIT_ASSERT( default_grid.isEquivalent(illegal_begin_props) == default_grid.isCongruent(illegal_begin_props)); 179 CPPUNIT_ASSERT( default_grid.isEquivalent(illegal_end_props) == default_grid.isCongruent(illegal_end_props)); 180 CPPUNIT_ASSERT( default_grid.isEquivalent(illegal_level_props) == default_grid.isCongruent(illegal_level_props)); 181 CPPUNIT_ASSERT( default_grid.isEquivalent(legal_props) == default_grid.isCongruent(legal_props) ); 149 182 150 183 default_grid.setWindowSize(begin, end);
Note:
See TracChangeset
for help on using the changeset viewer.
