[bcf653] | 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 |
|
---|
[266237] | 8 | /*
|
---|
[f844ef] | 9 | * ListOfBondsUnitTest.cpp
|
---|
[266237] | 10 | *
|
---|
| 11 | * Created on: 18 Oct 2009
|
---|
| 12 | * Author: user
|
---|
| 13 | */
|
---|
| 14 |
|
---|
[bf3817] | 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
[266237] | 20 | using namespace std;
|
---|
| 21 |
|
---|
| 22 | #include <cppunit/CompilerOutputter.h>
|
---|
| 23 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
| 24 | #include <cppunit/ui/text/TestRunner.h>
|
---|
| 25 |
|
---|
[49e1ae] | 26 | #include <cstring>
|
---|
| 27 |
|
---|
[255829] | 28 | #include "CodePatterns/Log.hpp"
|
---|
[46d958] | 29 | #include "World.hpp"
|
---|
[266237] | 30 | #include "atom.hpp"
|
---|
[129204] | 31 | #include "Bond/bond.hpp"
|
---|
[266237] | 32 | #include "element.hpp"
|
---|
| 33 | #include "molecule.hpp"
|
---|
| 34 | #include "periodentafel.hpp"
|
---|
[e6fdbe] | 35 | #include "World.hpp"
|
---|
[8aba3c] | 36 | #include "WorldTime.hpp"
|
---|
[266237] | 37 |
|
---|
[f844ef] | 38 | #include "ListOfBondsUnitTest.hpp"
|
---|
| 39 |
|
---|
[9b6b2f] | 40 | #ifdef HAVE_TESTRUNNER
|
---|
| 41 | #include "UnitTestMain.hpp"
|
---|
| 42 | #endif /*HAVE_TESTRUNNER*/
|
---|
[266237] | 43 |
|
---|
| 44 | /********************************************** Test classes **************************************/
|
---|
| 45 |
|
---|
| 46 | // Registers the fixture into the 'registry'
|
---|
| 47 | CPPUNIT_TEST_SUITE_REGISTRATION( ListOfBondsTest );
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | void ListOfBondsTest::setUp()
|
---|
| 51 | {
|
---|
| 52 | atom *Walker = NULL;
|
---|
| 53 |
|
---|
| 54 | // construct element
|
---|
[4eb4fe] | 55 | hydrogen = World::getInstance().getPeriode()->FindElement(1);
|
---|
| 56 | CPPUNIT_ASSERT(hydrogen != NULL && "could not find element hydrogen");
|
---|
[266237] | 57 |
|
---|
| 58 | // construct molecule (tetraeder of hydrogens)
|
---|
[23b547] | 59 | TestMolecule = World::getInstance().createMolecule();
|
---|
[4eb4fe] | 60 | CPPUNIT_ASSERT(TestMolecule != NULL && "could not create molecule");
|
---|
[23b547] | 61 | Walker = World::getInstance().createAtom();
|
---|
[4eb4fe] | 62 | CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
|
---|
[d74077] | 63 | Walker->setType(hydrogen);
|
---|
| 64 | Walker->setPosition(Vector(1., 0., 1. ));
|
---|
[266237] | 65 | TestMolecule->AddAtom(Walker);
|
---|
[23b547] | 66 | Walker = World::getInstance().createAtom();
|
---|
[4eb4fe] | 67 | CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
|
---|
[d74077] | 68 | Walker->setType(hydrogen);
|
---|
| 69 | Walker->setPosition(Vector(0., 1., 1. ));
|
---|
[266237] | 70 | TestMolecule->AddAtom(Walker);
|
---|
[23b547] | 71 | Walker = World::getInstance().createAtom();
|
---|
[4eb4fe] | 72 | CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
|
---|
[d74077] | 73 | Walker->setType(hydrogen);
|
---|
| 74 | Walker->setPosition(Vector(1., 1., 0. ));
|
---|
[266237] | 75 | TestMolecule->AddAtom(Walker);
|
---|
[23b547] | 76 | Walker = World::getInstance().createAtom();
|
---|
[4eb4fe] | 77 | CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
|
---|
[d74077] | 78 | Walker->setType(hydrogen);
|
---|
| 79 | Walker->setPosition(Vector(0., 0., 0. ));
|
---|
[266237] | 80 | TestMolecule->AddAtom(Walker);
|
---|
| 81 |
|
---|
| 82 | // check that TestMolecule was correctly constructed
|
---|
[ea7176] | 83 | CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
|
---|
[266237] | 84 | };
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | void ListOfBondsTest::tearDown()
|
---|
| 88 | {
|
---|
| 89 | // remove
|
---|
[23b547] | 90 | World::getInstance().destroyMolecule(TestMolecule);
|
---|
[a1510d] | 91 | // note that all the atoms, molecules, the tafel and the elements
|
---|
| 92 | // are all cleaned when the world is destroyed
|
---|
[23b547] | 93 | World::purgeInstance();
|
---|
[e6fdbe] | 94 | logger::purgeInstance();
|
---|
[266237] | 95 | };
|
---|
| 96 |
|
---|
[9879f6] | 97 | /** Tests whether setup worked correctly.
|
---|
| 98 | *
|
---|
| 99 | */
|
---|
| 100 | void ListOfBondsTest::SetupTest()
|
---|
| 101 | {
|
---|
| 102 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->empty() );
|
---|
| 103 | CPPUNIT_ASSERT_EQUAL( (size_t)4, TestMolecule->size() );
|
---|
| 104 | };
|
---|
| 105 |
|
---|
[266237] | 106 | /** Unit Test of molecule::AddBond()
|
---|
| 107 | *
|
---|
| 108 | */
|
---|
| 109 | void ListOfBondsTest::AddingBondTest()
|
---|
| 110 | {
|
---|
| 111 | bond *Binder = NULL;
|
---|
[9879f6] | 112 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 113 | atom *atom1 = *iter;
|
---|
| 114 | iter++;
|
---|
| 115 | atom *atom2 = *iter;
|
---|
[266237] | 116 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 117 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 118 |
|
---|
| 119 | // add bond
|
---|
| 120 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 121 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
[e08c46] | 122 | CPPUNIT_ASSERT_EQUAL ( true, TestMolecule->hasBondStructure() );
|
---|
[266237] | 123 |
|
---|
| 124 | // check that bond contains the two atoms
|
---|
| 125 | CPPUNIT_ASSERT_EQUAL( true, Binder->Contains(atom1) );
|
---|
| 126 | CPPUNIT_ASSERT_EQUAL( true, Binder->Contains(atom2) );
|
---|
| 127 |
|
---|
| 128 | // check that bond is present in both atoms
|
---|
[9d83b6] | 129 | BondList::const_iterator bonditer;
|
---|
| 130 | bonditer = atom1->getListOfBonds().begin();
|
---|
| 131 | bond *TestBond1 = *bonditer;
|
---|
[266237] | 132 | CPPUNIT_ASSERT_EQUAL( TestBond1, Binder );
|
---|
[9d83b6] | 133 | bonditer = atom2->getListOfBonds().begin();
|
---|
| 134 | bond *TestBond2 = *bonditer;
|
---|
[266237] | 135 | CPPUNIT_ASSERT_EQUAL( TestBond2, Binder );
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | /** Unit Test of molecule::RemoveBond()
|
---|
| 139 | *
|
---|
| 140 | */
|
---|
| 141 | void ListOfBondsTest::RemovingBondTest()
|
---|
| 142 | {
|
---|
| 143 | bond *Binder = NULL;
|
---|
[9879f6] | 144 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 145 | atom *atom1 = *iter;
|
---|
| 146 | iter++;
|
---|
| 147 | atom *atom2 = *iter;
|
---|
[266237] | 148 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 149 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 150 |
|
---|
| 151 | // add bond
|
---|
| 152 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 153 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 154 |
|
---|
| 155 | // remove bond
|
---|
| 156 | TestMolecule->RemoveBond(Binder);
|
---|
| 157 |
|
---|
| 158 | // check if removed from atoms
|
---|
[9d83b6] | 159 | {
|
---|
| 160 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 161 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 162 | }
|
---|
| 163 | {
|
---|
| 164 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 165 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 166 | }
|
---|
[266237] | 167 |
|
---|
| 168 | // check if removed from molecule
|
---|
[e08c46] | 169 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
|
---|
[266237] | 170 | };
|
---|
| 171 |
|
---|
| 172 | /** Unit Test of molecule::RemoveBonds()
|
---|
| 173 | *
|
---|
| 174 | */
|
---|
| 175 | void ListOfBondsTest::RemovingBondsTest()
|
---|
| 176 | {
|
---|
| 177 | bond *Binder = NULL;
|
---|
[9879f6] | 178 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 179 | atom *atom1 = *iter;
|
---|
| 180 | iter++;
|
---|
| 181 | atom *atom2 = *iter;
|
---|
| 182 | iter++;
|
---|
| 183 | atom *atom3 = *iter;
|
---|
[266237] | 184 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 185 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 186 | CPPUNIT_ASSERT( atom3 != NULL );
|
---|
| 187 |
|
---|
| 188 | // add bond
|
---|
| 189 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 190 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 191 | Binder = TestMolecule->AddBond(atom1, atom3, 1);
|
---|
| 192 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 193 | Binder = TestMolecule->AddBond(atom2, atom3, 1);
|
---|
| 194 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 195 |
|
---|
| 196 | // check that all are present
|
---|
[9d83b6] | 197 | {
|
---|
| 198 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 199 | CPPUNIT_ASSERT_EQUAL( (size_t) 2, ListOfBonds.size() );
|
---|
| 200 | }
|
---|
| 201 | {
|
---|
| 202 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 203 | CPPUNIT_ASSERT_EQUAL( (size_t) 2, ListOfBonds.size() );
|
---|
| 204 | }
|
---|
| 205 | {
|
---|
| 206 | const BondList& ListOfBonds = atom3->getListOfBonds();
|
---|
| 207 | CPPUNIT_ASSERT_EQUAL( (size_t) 2, ListOfBonds.size() );
|
---|
| 208 | }
|
---|
[266237] | 209 |
|
---|
| 210 | // remove bond
|
---|
| 211 | TestMolecule->RemoveBonds(atom1);
|
---|
| 212 |
|
---|
| 213 | // check if removed from atoms
|
---|
[9d83b6] | 214 | {
|
---|
| 215 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 216 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 217 | }
|
---|
| 218 | {
|
---|
| 219 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 220 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 221 | }
|
---|
| 222 | {
|
---|
| 223 | const BondList& ListOfBonds = atom3->getListOfBonds();
|
---|
| 224 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 225 | }
|
---|
[266237] | 226 |
|
---|
| 227 | // check if removed from molecule
|
---|
[e08c46] | 228 | CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
|
---|
[458c31] | 229 | CPPUNIT_ASSERT_EQUAL( (int)1, TestMolecule->getBondCount() );
|
---|
[266237] | 230 | };
|
---|
| 231 |
|
---|
| 232 | /** Unit Test of delete(bond *)
|
---|
| 233 | *
|
---|
| 234 | */
|
---|
| 235 | void ListOfBondsTest::DeleteBondTest()
|
---|
| 236 | {
|
---|
| 237 | bond *Binder = NULL;
|
---|
[9879f6] | 238 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 239 | atom *atom1 = *iter;
|
---|
| 240 | iter++;
|
---|
| 241 | atom *atom2 = *iter;
|
---|
[266237] | 242 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 243 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 244 |
|
---|
| 245 | // add bond
|
---|
| 246 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 247 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 248 |
|
---|
| 249 | // remove bond
|
---|
| 250 | delete(Binder);
|
---|
| 251 |
|
---|
| 252 | // check if removed from atoms
|
---|
[9d83b6] | 253 | {
|
---|
| 254 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 255 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 256 | }
|
---|
| 257 | {
|
---|
| 258 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 259 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 260 | }
|
---|
[266237] | 261 |
|
---|
| 262 | // check if removed from molecule
|
---|
[e08c46] | 263 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
|
---|
[266237] | 264 | };
|
---|
| 265 |
|
---|
| 266 | /** Unit Test of molecule::RemoveAtom()
|
---|
| 267 | *
|
---|
| 268 | */
|
---|
| 269 | void ListOfBondsTest::RemoveAtomTest()
|
---|
| 270 | {
|
---|
| 271 | bond *Binder = NULL;
|
---|
[9879f6] | 272 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 273 | atom *atom1 = *iter;
|
---|
| 274 | iter++;
|
---|
| 275 | atom *atom2 = *iter;
|
---|
[266237] | 276 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 277 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 278 |
|
---|
| 279 | // add bond
|
---|
| 280 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 281 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 282 |
|
---|
| 283 | // remove atom2
|
---|
| 284 | TestMolecule->RemoveAtom(atom2);
|
---|
| 285 |
|
---|
| 286 | // check bond if removed from other atom
|
---|
[9d83b6] | 287 | {
|
---|
| 288 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 289 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 290 | }
|
---|
[266237] | 291 |
|
---|
| 292 | // check if removed from molecule
|
---|
[e08c46] | 293 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
|
---|
[266237] | 294 | };
|
---|
| 295 |
|
---|
| 296 | /** Unit Test of delete(atom *)
|
---|
| 297 | *
|
---|
| 298 | */
|
---|
| 299 | void ListOfBondsTest::DeleteAtomTest()
|
---|
| 300 | {
|
---|
[f8e486] | 301 | atom *atom1 = NULL;
|
---|
| 302 | atom *atom2 = NULL;
|
---|
[266237] | 303 | bond *Binder = NULL;
|
---|
[f8e486] | 304 | {
|
---|
| 305 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 306 | atom1 = *iter;
|
---|
| 307 | iter++;
|
---|
| 308 | atom2 = *iter;
|
---|
| 309 | }
|
---|
[266237] | 310 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 311 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 312 |
|
---|
| 313 | // add bond
|
---|
| 314 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 315 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 316 |
|
---|
[8aba3c] | 317 | // access test via CurrentTime
|
---|
[9d83b6] | 318 | {
|
---|
| 319 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 320 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 321 | }
|
---|
| 322 | {
|
---|
| 323 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 324 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 325 | }
|
---|
[6cfa36] | 326 |
|
---|
[a80241] | 327 | CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
|
---|
| 328 |
|
---|
[266237] | 329 | // remove atom2
|
---|
[23b547] | 330 | World::getInstance().destroyAtom(atom2);
|
---|
[266237] | 331 |
|
---|
[8aba3c] | 332 | // check bond if removed from other atom for all time steps
|
---|
[9d83b6] | 333 | {
|
---|
| 334 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 335 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 336 | }
|
---|
[266237] | 337 |
|
---|
| 338 | // check if removed from molecule
|
---|
[a80241] | 339 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
|
---|
[266237] | 340 | };
|
---|
[8aba3c] | 341 |
|
---|
| 342 | /** Unit test on ListOfBonds at multiple time steps.
|
---|
| 343 | *
|
---|
| 344 | */
|
---|
| 345 | void ListOfBondsTest::MultipleTimeStepTest()
|
---|
| 346 | {
|
---|
| 347 | atom *atom1 = NULL;
|
---|
| 348 | atom *atom2 = NULL;
|
---|
| 349 | bond *Binder = NULL;
|
---|
| 350 | {
|
---|
| 351 | molecule::iterator iter = TestMolecule->begin();
|
---|
| 352 | atom1 = *iter;
|
---|
| 353 | iter++;
|
---|
| 354 | atom2 = *iter;
|
---|
| 355 | }
|
---|
| 356 | CPPUNIT_ASSERT( atom1 != NULL );
|
---|
| 357 | CPPUNIT_ASSERT( atom2 != NULL );
|
---|
| 358 |
|
---|
| 359 | // add bond
|
---|
| 360 | WorldTime::setTime(0);
|
---|
| 361 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 362 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 363 | WorldTime::setTime(1);
|
---|
| 364 | Binder = TestMolecule->AddBond(atom1, atom2, 1);
|
---|
| 365 | CPPUNIT_ASSERT( Binder != NULL );
|
---|
| 366 |
|
---|
| 367 | // access test via CurrentTime
|
---|
| 368 | { // time step 0
|
---|
| 369 | WorldTime::setTime(0);
|
---|
| 370 | {
|
---|
| 371 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 372 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 373 | }
|
---|
| 374 | {
|
---|
| 375 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 376 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 377 | }
|
---|
| 378 | CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
|
---|
| 379 | }
|
---|
| 380 | { // time step 1
|
---|
| 381 | WorldTime::setTime(1);
|
---|
| 382 | {
|
---|
| 383 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 384 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 385 | }
|
---|
| 386 | {
|
---|
| 387 | const BondList& ListOfBonds = atom2->getListOfBonds();
|
---|
| 388 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 389 | }
|
---|
| 390 | CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
|
---|
| 391 | WorldTime::setTime(0);
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | // access time step directly.
|
---|
| 395 | { // time step 0
|
---|
| 396 | {
|
---|
| 397 | const BondList& ListOfBonds = atom1->getListOfBondsAtStep(0);
|
---|
| 398 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 399 | }
|
---|
| 400 | {
|
---|
| 401 | const BondList& ListOfBonds = atom2->getListOfBondsAtStep(0);
|
---|
| 402 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 403 | }
|
---|
| 404 | }
|
---|
| 405 | { // time step 1
|
---|
| 406 | {
|
---|
| 407 | const BondList& ListOfBonds = atom1->getListOfBondsAtStep(1);
|
---|
| 408 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 409 | }
|
---|
| 410 | {
|
---|
| 411 | const BondList& ListOfBonds = atom1->getListOfBondsAtStep(1);
|
---|
| 412 | CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() );
|
---|
| 413 | }
|
---|
| 414 | }
|
---|
| 415 |
|
---|
| 416 | // remove atom2
|
---|
| 417 | World::getInstance().destroyAtom(atom2);
|
---|
| 418 |
|
---|
| 419 | // check bond if removed from other atom for all time steps
|
---|
| 420 | {
|
---|
| 421 | WorldTime::setTime(0);
|
---|
| 422 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 423 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 424 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
|
---|
| 425 | }
|
---|
| 426 | {
|
---|
| 427 | WorldTime::setTime(1);
|
---|
| 428 | const BondList& ListOfBonds = atom1->getListOfBonds();
|
---|
| 429 | CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() );
|
---|
| 430 | CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
|
---|
| 431 | WorldTime::setTime(0);
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 | }
|
---|