Changeset a7b761b for src/unittests


Ignore:
Timestamp:
May 27, 2010, 10:46:54 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
1024cb
Parents:
8f215d (diff), 05a97c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'MoleculeStartEndSwitch' into StructureRefactoring

Conflicts:

molecuilder/src/Helpers/Assert.cpp
molecuilder/src/Helpers/Assert.hpp
molecuilder/src/Legacy/oldmenu.cpp
molecuilder/src/Makefile.am
molecuilder/src/Patterns/Cacheable.hpp
molecuilder/src/Patterns/Observer.cpp
molecuilder/src/Patterns/Observer.hpp
molecuilder/src/analysis_correlation.cpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule.hpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/ObserverTest.cpp
molecuilder/src/unittests/ObserverTest.hpp

Location:
src/unittests
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r8f215d ra7b761b  
    2525#include "periodentafel.hpp"
    2626#include "tesselation.hpp"
    27 #include "World.hpp"
    2827
    2928#ifdef HAVE_TESTRUNNER
     
    8079
    8180  // check that TestMolecule was correctly constructed
    82   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
     81  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
    8382
    8483  TestList = World::getInstance().getMolecules();
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r8f215d ra7b761b  
    2626#include "tesselation.hpp"
    2727#include "World.hpp"
     28#include "Helpers/Assert.hpp"
    2829
    2930#include "Helpers/Assert.hpp"
     
    4041void AnalysisCorrelationToSurfaceUnitTest::setUp()
    4142{
    42   //ASSERT_DO(Assert::Throw);
     43  ASSERT_DO(Assert::Throw);
    4344
    4445  atom *Walker = NULL;
     
    7172  // construct molecule (tetraeder of hydrogens) base
    7273  TestSurfaceMolecule = World::getInstance().createMolecule();
     74
    7375  Walker = World::getInstance().createAtom();
    7476  Walker->type = hydrogen;
    7577  *Walker->node = Vector(1., 0., 1. );
    76 
    77   TestSurfaceMolecule->AddAtom(Walker);
     78  TestSurfaceMolecule->AddAtom(Walker);
     79
    7880  Walker = World::getInstance().createAtom();
    7981  Walker->type = hydrogen;
    8082  *Walker->node = Vector(0., 1., 1. );
    8183  TestSurfaceMolecule->AddAtom(Walker);
     84
    8285  Walker = World::getInstance().createAtom();
    8386  Walker->type = hydrogen;
    8487  *Walker->node = Vector(1., 1., 0. );
    8588  TestSurfaceMolecule->AddAtom(Walker);
     89
    8690  Walker = World::getInstance().createAtom();
    8791  Walker->type = hydrogen;
     
    9094
    9195  // check that TestMolecule was correctly constructed
    92   CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
     96  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->getAtomCount(), 4 );
    9397
    9498  TestList = World::getInstance().getMolecules();
     
    107111  *Walker->node = Vector(4., 0., 4. );
    108112  TestSurfaceMolecule->AddAtom(Walker);
     113
    109114  Walker = World::getInstance().createAtom();
    110115  Walker->type = carbon;
    111116  *Walker->node = Vector(0., 4., 4. );
    112117  TestSurfaceMolecule->AddAtom(Walker);
     118
    113119  Walker = World::getInstance().createAtom();
    114120  Walker->type = carbon;
    115121  *Walker->node = Vector(4., 4., 0. );
    116122  TestSurfaceMolecule->AddAtom(Walker);
     123
    117124  // add inner atoms
    118125  Walker = World::getInstance().createAtom();
     
    120127  *Walker->node = Vector(0.5, 0.5, 0.5 );
    121128  TestSurfaceMolecule->AddAtom(Walker);
     129
    122130  TestSurfaceMolecule->ActiveFlag = true;
    123131  TestList->insert(TestSurfaceMolecule);
     
    150158void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
    151159{
    152   CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
     160  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->getAtomCount() );
    153161  CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
    154162  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    r8f215d ra7b761b  
    7979
    8080  // check that TestMolecule was correctly constructed
    81   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
     81  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
    8282
    8383  TestList = World::getInstance().getMolecules();
  • src/unittests/CountBondsUnitTest.cpp

    r8f215d ra7b761b  
    102102
    103103  // check that TestMolecule was correctly constructed
    104   CPPUNIT_ASSERT_EQUAL( TestMolecule1->AtomCount, 3 );
    105   Walker = TestMolecule1->start->next;
    106   CPPUNIT_ASSERT( TestMolecule1->end != Walker );
    107   CPPUNIT_ASSERT_EQUAL( TestMolecule2->AtomCount, 3 );
    108   Walker = TestMolecule2->start->next;
    109   CPPUNIT_ASSERT( TestMolecule2->end != Walker );
     104  CPPUNIT_ASSERT_EQUAL( TestMolecule1->getAtomCount(), 3 );
     105  CPPUNIT_ASSERT_EQUAL( TestMolecule2->getAtomCount(), 3 );
    110106
    111107  // create a small file with table
  • src/unittests/LinkedCellUnitTest.cpp

    r8f215d ra7b761b  
    6969
    7070  // check that TestMolecule was correctly constructed
    71   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 3*3*3 );
    72   Walker = TestMolecule->start->next;
    73   CPPUNIT_ASSERT( TestMolecule->end != Walker );
     71  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 3*3*3 );
    7472};
    7573
     
    197195{
    198196  // check all atoms
    199   atom *Walker = TestMolecule->start;
    200   while (Walker->next != TestMolecule->end) {
    201     Walker = Walker->next;
    202     CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(Walker) );
     197  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end();++iter){
     198    CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(*iter) );
    203199  }
    204200
    205201  // check internal vectors, returns false, because this atom is not in LC-list!
    206   Walker = World::getInstance().createAtom();
    207   Walker->setName("test");
    208   Walker->x= Vector(1,1,1);
    209   CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(Walker) );
    210   World::getInstance().destroyAtom(Walker);
     202  atom *newAtom = World::getInstance().createAtom();
     203  newAtom->setName("test");
     204  newAtom->x= Vector(1,1,1);
     205  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
     206  World::getInstance().destroyAtom(newAtom);
    211207
    212208  // check out of bounds vectors
    213   Walker = World::getInstance().createAtom();
    214   Walker->setName("test");
    215   Walker->x = Vector(0,-1,0);
    216   CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(Walker) );
    217   World::getInstance().destroyAtom(Walker);
     209  newAtom = World::getInstance().createAtom();
     210  newAtom->setName("test");
     211  newAtom->x = Vector(0,-1,0);
     212  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
     213  World::getInstance().destroyAtom(newAtom);
    218214};
    219215
     
    287283  size = ListOfPoints->size();
    288284  CPPUNIT_ASSERT_EQUAL( (size_t)27, size );
    289   Walker = TestMolecule->start;
    290   Walker = TestMolecule->start;
    291   while (Walker->next != TestMolecule->end) {
    292     Walker = Walker->next;
    293     ListOfPoints->remove(Walker);
     285
     286  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
     287    ListOfPoints->remove((*iter));
    294288    size--;
    295289    CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
     
    306300  size=ListOfPoints->size();
    307301  CPPUNIT_ASSERT_EQUAL( (size_t)8, size );
    308   Walker = TestMolecule->start;
    309   while (Walker->next != TestMolecule->end) {
    310     Walker = Walker->next;
    311     if ((Walker->x[0] <2) && (Walker->x[1] <2) && (Walker->x[2] <2)) {
    312       ListOfPoints->remove(Walker);
     302  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
     303    if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) {
     304      ListOfPoints->remove(*iter);
    313305      size--;
    314306      CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
     
    326318  size=ListOfPoints->size();
    327319  CPPUNIT_ASSERT_EQUAL( (size_t)27, size );
    328   Walker = TestMolecule->start;
    329   while (Walker->next != TestMolecule->end) {
    330     Walker = Walker->next;
    331     ListOfPoints->remove(Walker);
     320  for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
     321    ListOfPoints->remove(*iter);
    332322    size--;
    333323    CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
     
    355345  size = ListOfPoints->size();
    356346  CPPUNIT_ASSERT_EQUAL( (size_t)7, size );
    357   Walker = TestMolecule->start;
    358   while (Walker->next != TestMolecule->end) {
    359     Walker = Walker->next;
    360     if ((Walker->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
    361       ListOfPoints->remove(Walker);
     347  for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
     348    if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
     349      ListOfPoints->remove(*iter);
    362350      size--;
    363351      CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
  • src/unittests/ObserverTest.cpp

    r8f215d ra7b761b  
    1111#include <cppunit/extensions/TestFactoryRegistry.h>
    1212#include <cppunit/ui/text/TestRunner.h>
     13#include <set>
    1314
    1415#include "Patterns/Observer.hpp"
     16#include "Patterns/ObservedIterator.hpp"
    1517#include "Helpers/Assert.hpp"
    1618
     
    162164  bool wasNotified;
    163165};
     166
     167class ObservableCollection : public Observable {
     168public:
     169  typedef std::set<SimpleObservable*> set;
     170  typedef ObservedIterator<set> iterator;
     171  typedef set::const_iterator const_iterator;
     172
     173  ObservableCollection(int _num) :
     174  num(_num)
     175  {
     176    for(int i=0; i<num; ++i){
     177      SimpleObservable *content = new SimpleObservable();
     178      content->signOn(this);
     179      theSet.insert(content);
     180    }
     181  }
     182
     183  ~ObservableCollection(){
     184    set::iterator iter;
     185    for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
     186      delete (*iter);
     187    }
     188  }
     189
     190  iterator begin(){
     191    return iterator(theSet.begin(),this);
     192  }
     193
     194  iterator end(){
     195    return iterator(theSet.end(),this);
     196  }
     197
     198  const int num;
     199
     200private:
     201  set theSet;
     202};
     203
    164204
    165205/******************* actuall tests ***************/
     
    173213  blockObservable = new BlockObservable();
    174214  notificationObservable = new NotificationObservable();
     215  collection = new ObservableCollection(5);
    175216
    176217  observer1 = new UpdateCountObserver();
     
    181222  notificationObserver1 = new NotificationObserver(notificationObservable->notification1);
    182223  notificationObserver2 = new NotificationObserver(notificationObservable->notification2);
    183 
    184224}
    185225
     
    191231  delete blockObservable;
    192232  delete notificationObservable;
     233  delete collection;
    193234
    194235  delete observer1;
     
    277318  blockObservable->changeMethod2();
    278319  blockObservable->noChangeMethod();
     320}
     321
     322void ObserverTest::iteratorTest(){
     323  int i = 0;
     324  // test the general iterator methods
     325  for(ObservableCollection::iterator iter=collection->begin(); iter!=collection->end();++iter){
     326    CPPUNIT_ASSERT(i< collection->num);
     327    i++;
     328  }
     329
     330  i=0;
     331  for(ObservableCollection::const_iterator iter=collection->begin(); iter!=collection->end();++iter){
     332    CPPUNIT_ASSERT(i<collection->num);
     333    i++;
     334  }
     335
     336  collection->signOn(observer1);
     337  {
     338    // we construct this out of the loop, so the iterator dies at the end of
     339    // the scope and not the end of the loop (allows more testing)
     340    ObservableCollection::iterator iter;
     341    for(iter=collection->begin(); iter!=collection->end(); ++iter){
     342      (*iter)->changeMethod();
     343    }
     344    // At this point no change should have been propagated
     345    CPPUNIT_ASSERT_EQUAL( 0, observer1->updates);
     346  }
     347  // After the Iterator has died the propagation should take place
     348  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
     349
     350  // when using a const_iterator no changes should be propagated
     351  for(ObservableCollection::const_iterator iter = collection->begin(); iter!=collection->end();++iter);
     352  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
     353  collection->signOff(observer1);
    279354}
    280355
  • src/unittests/ObserverTest.hpp

    r8f215d ra7b761b  
    1717class CallObservable;
    1818class SuperObservable;
     19class ObservableCollection;
    1920class BlockObservable;
    2021class NotificationObservable;
    21 
    2222
    2323class ObserverTest :  public CppUnit::TestFixture
     
    2929  CPPUNIT_TEST ( doesNotifyTest );
    3030  CPPUNIT_TEST ( doesReportTest );
     31  CPPUNIT_TEST ( iteratorTest );
    3132  CPPUNIT_TEST ( CircleDetectionTest );
    3233  CPPUNIT_TEST_SUITE_END();
     
    4142  void doesNotifyTest();
    4243  void doesReportTest();
     44  void iteratorTest();
    4345  void CircleDetectionTest();
    4446
     
    5860  SuperObservable *superObservable;
    5961  NotificationObservable *notificationObservable;
     62  ObservableCollection *collection;
     63
    6064};
    6165
  • src/unittests/analysisbondsunittest.cpp

    r8f215d ra7b761b  
    2525#include "molecule.hpp"
    2626#include "periodentafel.hpp"
     27#include "World.hpp"
    2728
    2829#ifdef HAVE_TESTRUNNER
     
    8990
    9091  // check that TestMolecule was correctly constructed
    91   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 5 );
     92  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 5 );
    9293
    9394  // create a small file with table
  • src/unittests/bondgraphunittest.cpp

    r8f215d ra7b761b  
    8989
    9090  // check that TestMolecule was correctly constructed
    91   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
     91  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
    9292
    9393  // create a small file with table
     
    120120};
    121121
     122/** Tests whether setup worked.
     123 */
     124void BondGraphTest::SetupTest()
     125{
     126  CPPUNIT_ASSERT_EQUAL (false, TestMolecule->empty());
     127  CPPUNIT_ASSERT_EQUAL ((size_t)4, TestMolecule->size());
     128};
     129
    122130/** UnitTest for BondGraphTest::LoadBondLengthTable().
    123131 */
     
    134142void BondGraphTest::ConstructGraphFromTableTest()
    135143{
    136   atom *Walker = TestMolecule->start->next;
    137   atom *Runner = TestMolecule->end->previous;
    138   CPPUNIT_ASSERT( TestMolecule->end != Walker );
     144  molecule::iterator Walker = TestMolecule->begin();
     145  molecule::iterator Runner = TestMolecule->begin();
     146  Runner++;
    139147  CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(*filename) );
    140148  CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
    141   CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
     149  CPPUNIT_ASSERT_EQUAL( true , (*Walker)->IsBondedTo((*Runner)) );
    142150};
    143151
     
    146154void BondGraphTest::ConstructGraphFromCovalentRadiiTest()
    147155{
    148   atom *Walker = TestMolecule->start->next;
    149   atom *Runner = TestMolecule->end->previous;
    150   CPPUNIT_ASSERT( TestMolecule->end != Walker );
     156
     157  //atom *Walker = TestMolecule->start->next;
     158  //atom *Runner = TestMolecule->end->previous;
     159  //CPPUNIT_ASSERT( TestMolecule->end != Walker );
    151160  CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(*dummyname) );
    152161  CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
    153   CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
     162
     163  // this cannot be assured using dynamic IDs
     164  //CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
    154165};
    155166
  • src/unittests/bondgraphunittest.hpp

    r8f215d ra7b761b  
    2222{
    2323    CPPUNIT_TEST_SUITE( BondGraphTest) ;
     24    CPPUNIT_TEST ( SetupTest );
    2425    CPPUNIT_TEST ( LoadTableTest );
    2526    CPPUNIT_TEST ( ConstructGraphFromTableTest );
     
    3031      void setUp();
    3132      void tearDown();
     33      void SetupTest();
    3234      void LoadTableTest();
    3335      void ConstructGraphFromTableTest();
  • src/unittests/listofbondsunittest.cpp

    r8f215d ra7b761b  
    7474
    7575  // check that TestMolecule was correctly constructed
    76   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
     76  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
    7777
    7878};
     
    9090};
    9191
     92/** Tests whether setup worked correctly.
     93 *
     94 */
     95void ListOfBondsTest::SetupTest()
     96{
     97  CPPUNIT_ASSERT_EQUAL( false, TestMolecule->empty() );
     98  CPPUNIT_ASSERT_EQUAL( (size_t)4, TestMolecule->size() );
     99};
     100
    92101/** Unit Test of molecule::AddBond()
    93102 *
     
    96105{
    97106  bond *Binder = NULL;
    98   atom *atom1 = TestMolecule->start->next;
    99   atom *atom2 = atom1->next;
     107  molecule::iterator iter = TestMolecule->begin();
     108  atom *atom1 = *iter;
     109  iter++;
     110  atom *atom2 = *iter;
    100111  CPPUNIT_ASSERT( atom1 != NULL );
    101112  CPPUNIT_ASSERT( atom2 != NULL );
     
    124135{
    125136  bond *Binder = NULL;
    126   atom *atom1 = TestMolecule->start->next;
    127   atom *atom2 = atom1->next;
     137  molecule::iterator iter = TestMolecule->begin();
     138  atom *atom1 = *iter;
     139  iter++;
     140  atom *atom2 = *iter;
    128141  CPPUNIT_ASSERT( atom1 != NULL );
    129142  CPPUNIT_ASSERT( atom2 != NULL );
     
    150163{
    151164  bond *Binder = NULL;
    152   atom *atom1 = TestMolecule->start->next;
    153   atom *atom2 = atom1->next;
    154   atom *atom3 = atom2->next;
     165  molecule::iterator iter = TestMolecule->begin();
     166  atom *atom1 = *iter;
     167  iter++;
     168  atom *atom2 = *iter;
     169  iter++;
     170  atom *atom3 = *iter;
    155171  CPPUNIT_ASSERT( atom1 != NULL );
    156172  CPPUNIT_ASSERT( atom2 != NULL );
     
    189205{
    190206  bond *Binder = NULL;
    191   atom *atom1 = TestMolecule->start->next;
    192   atom *atom2 = atom1->next;
     207  molecule::iterator iter = TestMolecule->begin();
     208  atom *atom1 = *iter;
     209  iter++;
     210  atom *atom2 = *iter;
    193211  CPPUNIT_ASSERT( atom1 != NULL );
    194212  CPPUNIT_ASSERT( atom2 != NULL );
     
    215233{
    216234  bond *Binder = NULL;
    217   atom *atom1 = TestMolecule->start->next;
    218   atom *atom2 = atom1->next;
     235  molecule::iterator iter = TestMolecule->begin();
     236  atom *atom1 = *iter;
     237  iter++;
     238  atom *atom2 = *iter;
    219239  CPPUNIT_ASSERT( atom1 != NULL );
    220240  CPPUNIT_ASSERT( atom2 != NULL );
     
    240260{
    241261  bond *Binder = NULL;
    242   atom *atom1 = TestMolecule->start->next;
    243   atom *atom2 = atom1->next;
     262  molecule::iterator iter = TestMolecule->begin();
     263  atom *atom1 = *iter;
     264  iter++;
     265  atom *atom2 = *iter;
    244266  CPPUNIT_ASSERT( atom1 != NULL );
    245267  CPPUNIT_ASSERT( atom2 != NULL );
  • src/unittests/listofbondsunittest.hpp

    r8f215d ra7b761b  
    2020{
    2121    CPPUNIT_TEST_SUITE( ListOfBondsTest) ;
     22    CPPUNIT_TEST ( SetupTest );
    2223    CPPUNIT_TEST ( AddingBondTest );
    2324    CPPUNIT_TEST ( RemovingBondTest );
     
    3132      void setUp();
    3233      void tearDown();
     34      void SetupTest();
    3335      void AddingBondTest();
    3436      void RemovingBondTest();
Note: See TracChangeset for help on using the changeset viewer.