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