[dcea0f] | 1 | /*
|
---|
| 2 | * LinkedCellUnitTest.cpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Apr 9, 2010
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[bf3817] | 8 | // include config.h
|
---|
| 9 | #ifdef HAVE_CONFIG_H
|
---|
| 10 | #include <config.h>
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
[dcea0f] | 13 | using namespace std;
|
---|
| 14 |
|
---|
| 15 | #include <cppunit/CompilerOutputter.h>
|
---|
| 16 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
| 17 | #include <cppunit/ui/text/TestRunner.h>
|
---|
| 18 |
|
---|
| 19 | #include <iostream>
|
---|
| 20 | #include <stdio.h>
|
---|
| 21 | #include <cstring>
|
---|
| 22 |
|
---|
| 23 | #include "atom.hpp"
|
---|
| 24 | #include "element.hpp"
|
---|
| 25 | #include "linkedcell.hpp"
|
---|
| 26 | #include "molecule.hpp"
|
---|
| 27 | #include "periodentafel.hpp"
|
---|
| 28 | #include "LinkedCellUnitTest.hpp"
|
---|
[5f612ee] | 29 | #include "World.hpp"
|
---|
| 30 |
|
---|
| 31 | #ifdef HAVE_TESTRUNNER
|
---|
| 32 | #include "UnitTestMain.hpp"
|
---|
| 33 | #endif /*HAVE_TESTRUNNER*/
|
---|
[dcea0f] | 34 |
|
---|
| 35 | /********************************************** Test classes **************************************/
|
---|
| 36 |
|
---|
| 37 | // Registers the fixture into the 'registry'
|
---|
| 38 | CPPUNIT_TEST_SUITE_REGISTRATION( LinkedCellTest );
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | void LinkedCellTest::setUp()
|
---|
| 42 | {
|
---|
| 43 | atom *Walker = NULL;
|
---|
| 44 |
|
---|
| 45 | // construct element
|
---|
[4eb4fe] | 46 | hydrogen = World::getInstance().getPeriode()->FindElement(1);
|
---|
| 47 | CPPUNIT_ASSERT(hydrogen != NULL && "could not find element hydrogen");
|
---|
[dcea0f] | 48 |
|
---|
| 49 | // construct molecule (water molecule)
|
---|
[5f612ee] | 50 | TestMolecule = World::getInstance().createMolecule();
|
---|
[4eb4fe] | 51 | CPPUNIT_ASSERT(TestMolecule != NULL && "could not create molecule");
|
---|
[4f9e47] | 52 | for (double x=0.5;x<3;x+=1.)
|
---|
| 53 | for (double y=0.5;y<3;y+=1.)
|
---|
| 54 | for (double z=0.5;z<3;z+=1.) {
|
---|
[5f612ee] | 55 | Walker = World::getInstance().createAtom();
|
---|
[4eb4fe] | 56 | CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
|
---|
[d74077] | 57 | Walker->setType(hydrogen);
|
---|
| 58 | Walker->setPosition(Vector(x, y, z ));
|
---|
[4f9e47] | 59 | TestMolecule->AddAtom(Walker);
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | // construct linked cell
|
---|
| 63 | LC = new LinkedCell (TestMolecule, 1.);
|
---|
[4eb4fe] | 64 | CPPUNIT_ASSERT(LC != NULL && "could not create LinkedCell");
|
---|
[dcea0f] | 65 |
|
---|
| 66 | // check that TestMolecule was correctly constructed
|
---|
[a7b761b] | 67 | CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 3*3*3 );
|
---|
[dcea0f] | 68 | };
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | void LinkedCellTest::tearDown()
|
---|
| 72 | {
|
---|
| 73 | delete(LC);
|
---|
[5f612ee] | 74 | World::purgeInstance();
|
---|
[dcea0f] | 75 | };
|
---|
| 76 |
|
---|
| 77 |
|
---|
[4f9e47] | 78 | /** UnitTest for LinkedCell::CheckBounds().
|
---|
| 79 | */
|
---|
| 80 | void LinkedCellTest::CheckBoundsTest()
|
---|
| 81 | {
|
---|
| 82 | // check for within bounds
|
---|
| 83 | LC->n[0] = LC->n[1] = LC->n[2] = 0;
|
---|
| 84 | CPPUNIT_ASSERT_EQUAL( true, LC->CheckBounds() );
|
---|
| 85 | LC->n[0] = LC->n[1] = LC->n[2] = 1;
|
---|
| 86 | CPPUNIT_ASSERT_EQUAL( true, LC->CheckBounds() );
|
---|
| 87 | LC->n[0] = LC->n[1] = LC->n[2] = 2;
|
---|
| 88 | CPPUNIT_ASSERT_EQUAL( true, LC->CheckBounds() );
|
---|
| 89 |
|
---|
| 90 | // check for out of bounds
|
---|
| 91 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 92 | LC->n[0] = 404040;
|
---|
| 93 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() );
|
---|
| 94 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 95 | LC->n[0] = 0;
|
---|
| 96 | LC->n[1] = 5000;
|
---|
| 97 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() );
|
---|
| 98 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 99 | LC->n[1] = 0;
|
---|
| 100 | LC->n[2] = -70;
|
---|
| 101 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() );
|
---|
| 102 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 103 | LC->n[0] = LC->n[1] = LC->n[2] = 3;
|
---|
| 104 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() );
|
---|
| 105 | };
|
---|
| 106 |
|
---|
| 107 |
|
---|
[dcea0f] | 108 | /** UnitTest for LinkedCell::GetCurrentCell().
|
---|
[4f9e47] | 109 | * Note that CheckBounds() is used and has to be tested already.
|
---|
[dcea0f] | 110 | */
|
---|
| 111 | void LinkedCellTest::GetCurrentCellTest()
|
---|
| 112 | {
|
---|
[4f9e47] | 113 | // within bounds
|
---|
| 114 | LC->n[0] = LC->n[1] = LC->n[2] = 0;
|
---|
| 115 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0 * 3*3 + 0 * 3 + 0], LC->GetCurrentCell() );
|
---|
| 116 | LC->n[0] = LC->n[1] = LC->n[2] = 1;
|
---|
| 117 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[1 * 3*3 + 1 * 3 + 1], LC->GetCurrentCell() );
|
---|
| 118 | LC->n[0] = LC->n[1] = LC->n[2] = 2;
|
---|
| 119 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetCurrentCell() );
|
---|
| 120 |
|
---|
| 121 | // out of bounds
|
---|
| 122 | LC->n[0] = LC->n[1] = LC->n[2] = 3;
|
---|
| 123 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 124 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetCurrentCell() );
|
---|
| 125 | LC->n[0] = LC->n[1] = LC->n[2] = -1;
|
---|
| 126 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 127 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetCurrentCell() );
|
---|
[dcea0f] | 128 | };
|
---|
| 129 |
|
---|
| 130 | /** UnitTest for LinkedCell::GetRelativeToCurrentCell().
|
---|
| 131 | */
|
---|
| 132 | void LinkedCellTest::GetRelativeToCurrentCellTest()
|
---|
| 133 | {
|
---|
[4f9e47] | 134 | int offset[3];
|
---|
| 135 |
|
---|
| 136 | // offset to (0,0,0) always
|
---|
| 137 | offset[0] = offset[1] = offset[2] = 0;
|
---|
| 138 | LC->n[0] = LC->n[1] = LC->n[2] = 0;
|
---|
| 139 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) );
|
---|
| 140 | offset[0] = offset[1] = offset[2] = -1;
|
---|
| 141 | LC->n[0] = LC->n[1] = LC->n[2] = 1;
|
---|
| 142 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) );
|
---|
| 143 | offset[0] = offset[1] = offset[2] = -2;
|
---|
| 144 | LC->n[0] = LC->n[1] = LC->n[2] = 2;
|
---|
| 145 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) );
|
---|
| 146 |
|
---|
| 147 | // offset to (0,0,0) - 1.*(x/y/z) out of bounds
|
---|
| 148 | offset[0] = offset[1] = offset[2] = 0;
|
---|
| 149 | offset[0] = -1;
|
---|
| 150 | LC->n[0] = LC->n[1] = LC->n[2] = 0;
|
---|
| 151 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 152 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );
|
---|
| 153 | offset[0] = offset[1] = offset[2] = 0;
|
---|
| 154 | offset[1] = -1;
|
---|
| 155 | LC->n[0] = LC->n[1] = LC->n[2] = 0;
|
---|
| 156 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 157 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );
|
---|
| 158 | offset[0] = offset[1] = offset[2] = 0;
|
---|
| 159 | offset[2] = -1;
|
---|
| 160 | LC->n[0] = LC->n[1] = LC->n[2] = 0;
|
---|
| 161 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 162 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );
|
---|
| 163 |
|
---|
| 164 | // out of bounds
|
---|
| 165 | offset[0] = offset[1] = offset[2] = -5054932;
|
---|
| 166 | LC->n[0] = LC->n[1] = LC->n[2] = 1;
|
---|
| 167 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 168 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );
|
---|
| 169 | offset[0] = offset[1] = offset[2] = 192345;
|
---|
| 170 | LC->n[0] = LC->n[1] = LC->n[2] = 1;
|
---|
| 171 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 172 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );
|
---|
| 173 |
|
---|
| 174 | // index is out of bounds, offset points within
|
---|
| 175 | offset[0] = offset[1] = offset[2] = -2;
|
---|
| 176 | LC->n[0] = LC->n[1] = LC->n[2] = 4;
|
---|
| 177 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetRelativeToCurrentCell(offset) );
|
---|
| 178 |
|
---|
| 179 | // index is within bounds, offset points out
|
---|
| 180 | offset[0] = offset[1] = offset[2] = 2;
|
---|
| 181 | LC->n[0] = LC->n[1] = LC->n[2] = 2;
|
---|
| 182 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
| 183 | CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );
|
---|
[dcea0f] | 184 | };
|
---|
| 185 |
|
---|
| 186 |
|
---|
| 187 | /** UnitTest for LinkedCell::SetIndexToNode().
|
---|
| 188 | */
|
---|
| 189 | void LinkedCellTest::SetIndexToNodeTest()
|
---|
| 190 | {
|
---|
[4f9e47] | 191 | // check all atoms
|
---|
[a7b761b] | 192 | for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end();++iter){
|
---|
| 193 | CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(*iter) );
|
---|
[4f9e47] | 194 | }
|
---|
| 195 |
|
---|
| 196 | // check internal vectors, returns false, because this atom is not in LC-list!
|
---|
[a7b761b] | 197 | atom *newAtom = World::getInstance().createAtom();
|
---|
| 198 | newAtom->setName("test");
|
---|
[d74077] | 199 | newAtom->setPosition(Vector(1,1,1));
|
---|
[a7b761b] | 200 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
|
---|
| 201 | World::getInstance().destroyAtom(newAtom);
|
---|
[4f9e47] | 202 |
|
---|
| 203 | // check out of bounds vectors
|
---|
[a7b761b] | 204 | newAtom = World::getInstance().createAtom();
|
---|
| 205 | newAtom->setName("test");
|
---|
[d74077] | 206 | newAtom->setPosition(Vector(0,-1,0));
|
---|
[a7b761b] | 207 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
|
---|
| 208 | World::getInstance().destroyAtom(newAtom);
|
---|
[dcea0f] | 209 | };
|
---|
| 210 |
|
---|
| 211 |
|
---|
| 212 | /** UnitTest for LinkedCell::SetIndexToVector().
|
---|
| 213 | */
|
---|
| 214 | void LinkedCellTest::SetIndexToVectorTest()
|
---|
| 215 | {
|
---|
[4f9e47] | 216 | Vector tester;
|
---|
| 217 |
|
---|
| 218 | // check center of each cell
|
---|
| 219 | for (double x=0.5;x<3;x+=1.)
|
---|
| 220 | for (double y=0.5;y<3;y+=1.)
|
---|
| 221 | for (double z=0.5;z<3;z+=1.) {
|
---|
[8cbb97] | 222 | tester = Vector(x,y,z);
|
---|
[d74077] | 223 | CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 224 | }
|
---|
| 225 | // check corners of each cell
|
---|
| 226 | for (double x=1.;x<4;x+=1.)
|
---|
| 227 | for (double y=1.;y<4;y+=1.)
|
---|
| 228 | for (double z=1.;z<4;z+=1.) {
|
---|
[8cbb97] | 229 | tester= Vector(x,y,z);
|
---|
[4f9e47] | 230 | cout << "Tester is at " << tester << "." << endl;
|
---|
[d74077] | 231 | CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 232 | }
|
---|
| 233 | // check out of bounds
|
---|
| 234 | for (double x=0.5-1e-10;x<5;x+=3.1)
|
---|
| 235 | for (double y=0.5-1e-10;y<5;y+=3.1)
|
---|
| 236 | for (double z=0.5-1e-10;z<5;z+=3.1) {
|
---|
[8cbb97] | 237 | tester = Vector(x,y,z);
|
---|
[4f9e47] | 238 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
[d74077] | 239 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 240 | }
|
---|
| 241 | // check nonsense vectors
|
---|
[8cbb97] | 242 | tester= Vector(-423598,3245978,29349);
|
---|
[4f9e47] | 243 | cout << "The following test is supposed to fail and produce an ERROR." << endl;
|
---|
[d74077] | 244 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
|
---|
[dcea0f] | 245 | };
|
---|
| 246 |
|
---|
| 247 |
|
---|
| 248 | /** UnitTest for LinkedCell::GetNeighbourBounds().
|
---|
| 249 | */
|
---|
| 250 | void LinkedCellTest::GetNeighbourBoundsTest()
|
---|
| 251 | {
|
---|
[4f9e47] | 252 | Vector tester;
|
---|
| 253 | int lower[NDIM], upper[NDIM];
|
---|
| 254 |
|
---|
[8cbb97] | 255 | tester= Vector(0.5,0.5,0.5);
|
---|
[d74077] | 256 | LC->SetIndexToVector(tester);
|
---|
[4f9e47] | 257 | LC->GetNeighbourBounds(lower, upper);
|
---|
| 258 | for (int i=0;i<NDIM;i++)
|
---|
| 259 | CPPUNIT_ASSERT_EQUAL( 0, lower[i]);
|
---|
| 260 | for (int i=0;i<NDIM;i++)
|
---|
| 261 | CPPUNIT_ASSERT_EQUAL( 1, upper[i]);
|
---|
[dcea0f] | 262 | };
|
---|
| 263 |
|
---|
| 264 |
|
---|
| 265 | /** UnitTest for LinkedCell::GetallNeighbours().
|
---|
| 266 | */
|
---|
| 267 | void LinkedCellTest::GetallNeighboursTest()
|
---|
| 268 | {
|
---|
[4f9e47] | 269 | Vector tester;
|
---|
| 270 | LinkedCell::LinkedNodes *ListOfPoints = NULL;
|
---|
| 271 | size_t size = 0;
|
---|
| 272 |
|
---|
| 273 | // get all atoms
|
---|
[8cbb97] | 274 | tester= Vector(1.5,1.5,1.5);
|
---|
[d74077] | 275 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 276 | ListOfPoints = LC->GetallNeighbours();
|
---|
| 277 | size = ListOfPoints->size();
|
---|
| 278 | CPPUNIT_ASSERT_EQUAL( (size_t)27, size );
|
---|
[a7b761b] | 279 |
|
---|
| 280 | for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
|
---|
| 281 | ListOfPoints->remove((*iter));
|
---|
[4f9e47] | 282 | size--;
|
---|
| 283 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
|
---|
| 284 | }
|
---|
| 285 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size );
|
---|
| 286 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() );
|
---|
| 287 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() );
|
---|
| 288 | delete(ListOfPoints);
|
---|
| 289 |
|
---|
| 290 | // get all atoms in one corner
|
---|
[8cbb97] | 291 | tester= Vector(0.5, 0.5, 0.5);
|
---|
[d74077] | 292 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 293 | ListOfPoints = LC->GetallNeighbours();
|
---|
| 294 | size=ListOfPoints->size();
|
---|
| 295 | CPPUNIT_ASSERT_EQUAL( (size_t)8, size );
|
---|
[a7b761b] | 296 | for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
|
---|
[d74077] | 297 | if (((*iter)->at(0) <2) && ((*iter)->at(1) <2) && ((*iter)->at(2) <2)) {
|
---|
[a7b761b] | 298 | ListOfPoints->remove(*iter);
|
---|
[4f9e47] | 299 | size--;
|
---|
| 300 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
|
---|
| 301 | }
|
---|
| 302 | }
|
---|
| 303 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size );
|
---|
| 304 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() );
|
---|
| 305 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() );
|
---|
| 306 | delete(ListOfPoints);
|
---|
| 307 |
|
---|
| 308 | // get all atoms from one corner
|
---|
[8cbb97] | 309 | tester = Vector(0.5, 0.5, 0.5);
|
---|
[d74077] | 310 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 311 | ListOfPoints = LC->GetallNeighbours(3);
|
---|
| 312 | size=ListOfPoints->size();
|
---|
| 313 | CPPUNIT_ASSERT_EQUAL( (size_t)27, size );
|
---|
[a7b761b] | 314 | for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
|
---|
| 315 | ListOfPoints->remove(*iter);
|
---|
[4f9e47] | 316 | size--;
|
---|
| 317 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
|
---|
| 318 | }
|
---|
| 319 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size );
|
---|
| 320 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() );
|
---|
| 321 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() );
|
---|
| 322 | delete(ListOfPoints);
|
---|
[dcea0f] | 323 | };
|
---|
| 324 |
|
---|
| 325 |
|
---|
| 326 | /** UnitTest for LinkedCell::GetPointsInsideSphere().
|
---|
| 327 | */
|
---|
| 328 | void LinkedCellTest::GetPointsInsideSphereTest()
|
---|
| 329 | {
|
---|
[4f9e47] | 330 | Vector tester;
|
---|
| 331 | LinkedCell::LinkedNodes *ListOfPoints = NULL;
|
---|
| 332 | size_t size = 0;
|
---|
| 333 |
|
---|
| 334 | // get all points around central arom with radius 1.
|
---|
[8cbb97] | 335 | tester= Vector(1.5,1.5,1.5);
|
---|
[d74077] | 336 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
|
---|
[4f9e47] | 337 | ListOfPoints = LC->GetPointsInsideSphere(1., &tester);
|
---|
| 338 | size = ListOfPoints->size();
|
---|
| 339 | CPPUNIT_ASSERT_EQUAL( (size_t)7, size );
|
---|
[a7b761b] | 340 | for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
|
---|
[d74077] | 341 | if (((*iter)->DistanceSquared(tester) - 1.) < MYEPSILON ) {
|
---|
[a7b761b] | 342 | ListOfPoints->remove(*iter);
|
---|
[4f9e47] | 343 | size--;
|
---|
| 344 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
|
---|
| 345 | }
|
---|
| 346 | }
|
---|
| 347 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size );
|
---|
| 348 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() );
|
---|
| 349 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() );
|
---|
| 350 | delete(ListOfPoints);
|
---|
[dcea0f] | 351 | };
|
---|