Changeset 5f612ee for src/unittests


Ignore:
Timestamp:
Apr 27, 2010, 2:25:42 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
632bc3
Parents:
13d5a9 (diff), c695c9 (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 'Analysis_PairCorrelation' into StructureRefactoring

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/World.cpp
molecuilder/src/World.hpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/log.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/periodentafel.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/Makefile.am
molecuilder/src/unittests/bondgraphunittest.cpp
molecuilder/src/unittests/gslvectorunittest.cpp
molecuilder/src/unittests/logunittest.cpp
molecuilder/src/unittests/tesselation_boundarytriangleunittest.hpp
molecuilder/src/vector.cpp
molecuilder/tests/Tesselations/defs.in

Conflicts have been many and too numerous to listen here, just the few general cases

  • new molecule() replaced by World::getInstance().createMolecule()
  • new atom() replaced by World::getInstance().createAtom() where appropriate.
  • Some DoLog()s added interfered with changes to the message produced by Log() << Verbose(.) << ...
  • DoLog() has been erroneously added to TestRunner.cpp as well, there cout is appropriate
  • ...

Additionally, there was a bug in atom::clone(), sort was set to atom::nr of the atom to clone not of the clone itself. This caused a failure of the fragmentation.

This merge has been fully checked from a clean build directory with subsequent configure,make all install and make check.
It configures, compiles and runs all test cases and the test suite without errors.

Signed-off-by: Frederik Heber <heber@…>

Location:
src/unittests
Files:
4 added
15 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r13d5a9 r5f612ee  
    8383
    8484  TestList = World::getInstance().getMolecules();
     85  TestList->insert(TestMolecule);
    8586  TestMolecule->ActiveFlag = true;
    86   TestList->insert(TestMolecule);
    8787
    8888  // init point
     
    122122  // put pair correlation into bins and check with no range
    123123  binmap = BinData( pointmap, 0.5, 0., 0. );
    124   CPPUNIT_ASSERT_EQUAL( (size_t)2, binmap->size() );
    125   //OutputCorrelation ( binmap );
     124  OutputCorrelation ( (ofstream *)&cout, binmap );
     125  CPPUNIT_ASSERT_EQUAL( (size_t)3, binmap->size() );
    126126  tester = binmap->begin();
    127127  CPPUNIT_ASSERT_EQUAL( 1., tester->first );
     
    135135  // ... and check with [0., 2.] range
    136136  binmap = BinData( pointmap, 0.5, 0., 2. );
     137  OutputCorrelation ( (ofstream *)&cout, binmap );
    137138  CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() );
    138   //OutputCorrelation ( binmap );
    139139  tester = binmap->begin();
    140140  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r13d5a9 r5f612ee  
    7070
    7171  // construct molecule (tetraeder of hydrogens) base
     72  TestSurfaceMolecule = World::getInstance().createMolecule();
     73  Walker = World::getInstance().createAtom();
     74  Walker->type = hydrogen;
     75  Walker->node->Init(1., 0., 1. );
     76  TestSurfaceMolecule->AddAtom(Walker);
     77  Walker = World::getInstance().createAtom();
     78  Walker->type = hydrogen;
     79  Walker->node->Init(0., 1., 1. );
     80  TestSurfaceMolecule->AddAtom(Walker);
     81  Walker = World::getInstance().createAtom();
     82  Walker->type = hydrogen;
     83  Walker->node->Init(1., 1., 0. );
     84  TestSurfaceMolecule->AddAtom(Walker);
     85  Walker = World::getInstance().createAtom();
     86  Walker->type = hydrogen;
     87  Walker->node->Init(0., 0., 0. );
     88  TestSurfaceMolecule->AddAtom(Walker);
     89
     90  // check that TestMolecule was correctly constructed
     91  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
     92
     93  TestList = World::getInstance().getMolecules();
     94  TestSurfaceMolecule->ActiveFlag = true;
     95  TestList->insert(TestSurfaceMolecule);
     96
     97  // init tesselation and linked cell
     98  Surface = new Tesselation;
     99  LC = new LinkedCell(TestSurfaceMolecule, 5.);
     100  FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
     101
     102  // add outer atoms
    72103  TestMolecule = World::getInstance().createMolecule();
    73104  Walker = World::getInstance().createAtom();
    74   Walker->type = hydrogen;
    75   Walker->node->Init(1., 0., 1. );
    76   TestMolecule->AddAtom(Walker);
    77   Walker = World::getInstance().createAtom();
    78   Walker->type = hydrogen;
    79   Walker->node->Init(0., 1., 1. );
    80   TestMolecule->AddAtom(Walker);
    81   Walker = World::getInstance().createAtom();
    82   Walker->type = hydrogen;
    83   Walker->node->Init(1., 1., 0. );
    84   TestMolecule->AddAtom(Walker);
    85   Walker = World::getInstance().createAtom();
    86   Walker->type = hydrogen;
    87   Walker->node->Init(0., 0., 0. );
    88   TestMolecule->AddAtom(Walker);
    89 
    90   // check that TestMolecule was correctly constructed
    91   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    92 
    93   TestList = World::getInstance().getMolecules();
     105  Walker->type = carbon;
     106  Walker->node->Init(4., 0., 4. );
     107  TestMolecule->AddAtom(Walker);
     108  Walker = World::getInstance().createAtom();
     109  Walker->type = carbon;
     110  Walker->node->Init(0., 4., 4. );
     111  TestMolecule->AddAtom(Walker);
     112  Walker = World::getInstance().createAtom();
     113  Walker->type = carbon;
     114  Walker->node->Init(4., 4., 0. );
     115  TestMolecule->AddAtom(Walker);
     116  // add inner atoms
     117  Walker = World::getInstance().createAtom();
     118  Walker->type = carbon;
     119  Walker->node->Init(0.5, 0.5, 0.5 );
     120  TestMolecule->AddAtom(Walker);
    94121  TestMolecule->ActiveFlag = true;
    95122  TestList->insert(TestMolecule);
    96 
    97   // init tesselation and linked cell
    98   Surface = new Tesselation;
    99   FindNonConvexBorder(TestMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
    100   LC = new LinkedCell(TestMolecule, 5.);
    101   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
    102   CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
    103   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
    104 
    105   // add outer atoms
    106   Walker = World::getInstance().createAtom();
    107   Walker->type = carbon;
    108   Walker->node->Init(4., 0., 4. );
    109   TestMolecule->AddAtom(Walker);
    110   Walker = World::getInstance().createAtom();
    111   Walker->type = carbon;
    112   Walker->node->Init(0., 4., 4. );
    113   TestMolecule->AddAtom(Walker);
    114   Walker = World::getInstance().createAtom();
    115   Walker->type = carbon;
    116   Walker->node->Init(4., 4., 0. );
    117   TestMolecule->AddAtom(Walker);
    118   // add inner atoms
    119   Walker = World::getInstance().createAtom();
    120   Walker->type = carbon;
    121   Walker->node->Init(0.5, 0.5, 0.5 );
    122   TestMolecule->AddAtom(Walker);
    123123
    124124  // init maps
     
    145145
    146146
     147/** Checks whether setup() does the right thing.
     148 */
     149void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
     150{
     151  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
     152  CPPUNIT_ASSERT_EQUAL( 4, TestMolecule->AtomCount );
     153  CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
     154  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
     155  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
     156  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
     157};
     158
    147159void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceTest()
    148160{
    149161  // do the pair correlation
    150162  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     163//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    151164  CPPUNIT_ASSERT( surfacemap != NULL );
    152165  CPPUNIT_ASSERT_EQUAL( (size_t)4, surfacemap->size() );
     
    158171  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
    159172  // put pair correlation into bins and check with no range
     173//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    160174  binmap = BinData( surfacemap, 0.5, 0., 0. );
    161175  CPPUNIT_ASSERT_EQUAL( (size_t)1, binmap->size() );
    162   //OutputCorrelation ( binmap );
     176  OutputCorrelation ( (ofstream *)&cout, binmap );
    163177  tester = binmap->begin();
    164178  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    171185  BinPairMap::iterator tester;
    172186  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     187//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    173188  // ... and check with [0., 2.] range
    174189  binmap = BinData( surfacemap, 0.5, 0., 2. );
    175190  CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() );
    176   //OutputCorrelation ( binmap );
     191//  OutputCorrelation ( (ofstream *)&cout, binmap );
    177192  tester = binmap->begin();
    178193  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    188203  BinPairMap::iterator tester;
    189204  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     205//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    190206  // put pair correlation into bins and check with no range
    191207  binmap = BinData( surfacemap, 0.5, 0., 0. );
    192   CPPUNIT_ASSERT_EQUAL( (size_t)2, binmap->size() );
    193   OutputCorrelation ( (ofstream *)&cout, binmap );
     208  //OutputCorrelation ( (ofstream *)&cout, binmap );
     209  CPPUNIT_ASSERT_EQUAL( (size_t)9, binmap->size() );
    194210  // inside point is first and must have negative value
    195   tester = binmap->lower_bound(2.95); // start depends on the min value and
     211  tester = binmap->lower_bound(4.25-0.5); // start depends on the min value and
    196212  CPPUNIT_ASSERT( tester != binmap->end() );
    197213  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    198214  // inner point
    199   tester = binmap->lower_bound(-0.5);
     215  tester = binmap->lower_bound(0.);
    200216  CPPUNIT_ASSERT( tester != binmap->end() );
    201217  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
     
    206222  BinPairMap::iterator tester;
    207223  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     224//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    208225  // ... and check with [0., 2.] range
    209226  binmap = BinData( surfacemap, 0.5, -2., 4. );
     227  //OutputCorrelation ( (ofstream *)&cout, binmap );
    210228  CPPUNIT_ASSERT_EQUAL( (size_t)13, binmap->size() );
    211   OutputCorrelation ( (ofstream *)&cout, binmap );
    212229  // three outside points
    213   tester = binmap->lower_bound(3.);
     230  tester = binmap->lower_bound(4.25-0.5);
    214231  CPPUNIT_ASSERT( tester != binmap->end() );
    215232  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    216233  // inner point
    217   tester = binmap->lower_bound(-0.5);
     234  tester = binmap->lower_bound(0.);
    218235  CPPUNIT_ASSERT( tester != binmap->end() );
    219236  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
    220 
    221 };
     237};
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp

    r13d5a9 r5f612ee  
    2323{
    2424    CPPUNIT_TEST_SUITE( AnalysisCorrelationToSurfaceUnitTest ) ;
     25    CPPUNIT_TEST ( SurfaceTest );
    2526    CPPUNIT_TEST ( CorrelationToSurfaceTest );
    2627    CPPUNIT_TEST ( CorrelationToSurfaceHydrogenBinNoRangeTest );
     
    3334      void setUp();
    3435      void tearDown();
     36      void SurfaceTest();
    3537      void CorrelationToSurfaceTest();
    3638      void CorrelationToSurfaceHydrogenBinNoRangeTest();
     
    4345      MoleculeListClass *TestList;
    4446      molecule *TestMolecule;
     47      molecule *TestSurfaceMolecule;
    4548      element *hydrogen;
    4649      element *carbon;
  • src/unittests/Makefile.am

    r13d5a9 r5f612ee  
    44AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    55
    6 MENUTESTS = ActionSequenceTest
     6MENUTESTS = \
     7  ActionSequenceTest
    78
    89TESTS = \
     
    1617  BondGraphUnitTest \
    1718  CacheableTest \
     19  CountBondsUnitTest \
    1820  GSLMatrixSymmetricUnitTest \
    1921  GSLMatrixUnitTest \
     
    2123  InfoUnitTest \
    2224  LinearSystemOfEquationsUnitTest \
     25  LinkedCellUnitTest \
    2326  ListOfBondsUnitTest \
    2427  LogUnitTest \
     
    3639  ${MENUTESTS}
    3740 
    38 
    39      
    4041 
    4142check_PROGRAMS = $(TESTS)
     
    5657  bondgraphunittest.cpp \
    5758  CacheableTest.cpp \
     59  CountBondsUnitTest.cpp \
    5860  gslmatrixsymmetricunittest.cpp \
    5961  gslmatrixunittest.cpp \
     
    6163  infounittest.cpp \
    6264  linearsystemofequationsunittest.cpp \
     65  LinkedCellUnitTest.cpp \
    6366  listofbondsunittest.cpp \
    6467  logunittest.cpp \
     
    7679
    7780TESTHEADERS = \
    78   analysis_correlation.hpp
     81  ActOnAllUnitTest.hpp \
     82  ActionSequenceTest.hpp \
     83  analysisbondsunittest.hpp \
     84  AnalysisCorrelationToPointUnitTest.hpp \
     85  AnalysisCorrelationToSurfaceUnitTest.hpp  \
     86  AnalysisPairCorrelationUnitTest.hpp \
     87  AtomDescriptorTest.hpp \
     88  atomsCalculationTest.hpp \
     89  bondgraphunittest.hpp \
     90  CacheableTest.hpp \
     91  CountBondsUnitTest.hpp \
     92  gslmatrixsymmetricunittest.hpp \
     93  gslmatrixunittest.hpp \
     94  gslvectorunittest.hpp \
     95  infounittest.hpp \
     96  linearsystemofequationsunittest.hpp \
     97  LinkedCellUnitTest.hpp \
     98  listofbondsunittest.hpp \
     99  logunittest.hpp \
     100  manipulateAtomsTest.hpp \
     101  memoryallocatorunittest.hpp  \
     102  memoryusageobserverunittest.hpp \
     103  MoleculeDescriptorTest.hpp \
     104  ObserverTest.hpp \
     105  SingletonTest.hpp \
     106  stackclassunittest.hpp \
     107  tesselationunittest.hpp \
     108  tesselation_boundarytriangleunittest.hpp \
     109  tesselation_insideoutsideunittest.hpp \
     110  vectorunittest.hpp
     111 
    79112
    80113ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
     
    99132BondGraphUnitTest_LDADD = ${ALLLIBS}
    100133
     134CountBondsUnitTest_SOURCES = UnitTestMain.cpp CountBondsUnitTest.cpp CountBondsUnitTest.hpp
     135CountBondsUnitTest_LDADD = ${ALLLIBS}
     136
    101137GSLMatrixSymmetricUnitTest_SOURCES = UnitTestMain.cpp gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp
    102138GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS}
     
    114150LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}
    115151
     152LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp
     153LinkedCellUnitTest_LDADD = ${ALLLIBS}
     154
    116155ListOfBondsUnitTest_SOURCES = UnitTestMain.cpp listofbondsunittest.cpp listofbondsunittest.hpp
    117156ListOfBondsUnitTest_LDADD = ${ALLLIBS}
  • src/unittests/bondgraphunittest.cpp

    r13d5a9 r5f612ee  
    2121#include "bondgraph.hpp"
    2222#include "element.hpp"
     23#include "log.hpp"
    2324#include "molecule.hpp"
    2425#include "periodentafel.hpp"
     
    4849  hydrogen = new element;
    4950  hydrogen->Z = 1;
     51  hydrogen->CovalentRadius = 0.23;
     52  hydrogen->VanDerWaalsRadius = 1.09;
    5053  strcpy(hydrogen->name, "hydrogen");
    5154  strcpy(hydrogen->symbol, "H");
    5255  carbon = new element;
    5356  carbon->Z = 2;
     57  carbon->CovalentRadius = 0.68;
     58  carbon->VanDerWaalsRadius = 1.7;
    5459  strcpy(carbon->name, "carbon");
    5560  strcpy(carbon->symbol, "C");
     
    6469  TestMolecule = World::getInstance().createMolecule();
    6570  Walker = World::getInstance().createAtom();
    66   Walker->type = hydrogen;
     71  Walker->type = carbon;
    6772  Walker->node->Init(1., 0., 1. );
    6873  TestMolecule->AddAtom(Walker);
    6974  Walker = World::getInstance().createAtom();
    70   Walker->type = hydrogen;
     75  Walker->type = carbon;
    7176  Walker->node->Init(0., 1., 1. );
    7277  TestMolecule->AddAtom(Walker);
    7378  Walker = World::getInstance().createAtom();
    74   Walker->type = hydrogen;
     79  Walker->type = carbon;
    7580  Walker->node->Init(1., 1., 0. );
    7681  TestMolecule->AddAtom(Walker);
    7782  Walker = World::getInstance().createAtom();
    78   Walker->type = hydrogen;
     83  Walker->type = carbon;
    7984  Walker->node->Init(0., 0., 0. );
    8085  TestMolecule->AddAtom(Walker);
     
    8489
    8590  // create a small file with table
     91  dummyname = new string("dummy.dat");
    8692  filename = new string("test.dat");
    8793  ofstream test(filename->c_str());
     
    99105  remove(filename->c_str());
    100106  delete(filename);
     107  delete(dummyname);
    101108  delete(BG);
    102109
     
    122129/** UnitTest for BondGraphTest::ConstructBondGraph().
    123130 */
    124 void BondGraphTest::ConstructGraphTest()
     131void BondGraphTest::ConstructGraphFromTableTest()
    125132{
    126133  atom *Walker = TestMolecule->start->next;
     
    131138  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
    132139};
     140
     141/** UnitTest for BondGraphTest::ConstructBondGraph().
     142 */
     143void BondGraphTest::ConstructGraphFromCovalentRadiiTest()
     144{
     145  atom *Walker = TestMolecule->start->next;
     146  atom *Runner = TestMolecule->end->previous;
     147  CPPUNIT_ASSERT( TestMolecule->end != Walker );
     148  CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(*dummyname) );
     149  CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
     150  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
     151};
     152
  • src/unittests/bondgraphunittest.hpp

    r13d5a9 r5f612ee  
    2323    CPPUNIT_TEST_SUITE( BondGraphTest) ;
    2424    CPPUNIT_TEST ( LoadTableTest );
    25     CPPUNIT_TEST ( ConstructGraphTest );
     25    CPPUNIT_TEST ( ConstructGraphFromTableTest );
     26    CPPUNIT_TEST ( ConstructGraphFromCovalentRadiiTest );
    2627    CPPUNIT_TEST_SUITE_END();
    2728
     
    3031      void tearDown();
    3132      void LoadTableTest();
    32       void ConstructGraphTest();
     33      void ConstructGraphFromTableTest();
     34      void ConstructGraphFromCovalentRadiiTest();
    3335
    3436private:
     
    4143      BondGraph *BG;
    4244      string *filename;
     45      string *dummyname;
    4346};
    4447
  • src/unittests/gslvectorunittest.cpp

    r13d5a9 r5f612ee  
    117117    CPPUNIT_ASSERT_EQUAL( (double)(3-j), v->Get(j) );
    118118};
     119
     120/** UnitTest for operators.
     121 */
     122void GSLVectorTest::OperatorIsTest()
     123{
     124  GSLVector zero(3);
     125  GSLVector unit(3);
     126  zero.SetZero();
     127  unit.SetZero();
     128  unit.Set(1,1.);
     129  // summation and scaling
     130  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
     131  CPPUNIT_ASSERT_EQUAL( false, zero.IsOne() );
     132  CPPUNIT_ASSERT_EQUAL( false, unit.IsZero() );
     133  CPPUNIT_ASSERT_EQUAL( true, zero.IsZero() );
     134};
     135
     136/** UnitTest for operators.
     137 */
     138void GSLVectorTest::OperatorAlgebraTest()
     139{
     140  GSLVector zero(3);
     141  GSLVector unit(3);
     142  zero.SetZero();
     143  unit.SetZero();
     144  unit.Set(1,1.);
     145  // summation and scaling
     146  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
     147  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
     148  CPPUNIT_ASSERT_EQUAL( true, (zero-unit).IsOne() );
     149  CPPUNIT_ASSERT_EQUAL( false, (zero-unit).IsZero() );
     150  CPPUNIT_ASSERT_EQUAL( true, (zero+zero).IsZero() );
     151  CPPUNIT_ASSERT_EQUAL( false, (unit*0.98).IsOne() );
     152  CPPUNIT_ASSERT_EQUAL( false, (0.98*unit).IsOne() );
     153  CPPUNIT_ASSERT_EQUAL( true, (unit*1.).IsOne() );
     154  CPPUNIT_ASSERT_EQUAL( true, (1.*unit).IsOne() );
     155
     156  CPPUNIT_ASSERT_EQUAL( unit, (zero+unit) );
     157  CPPUNIT_ASSERT_EQUAL( zero, (zero+zero) );
     158  CPPUNIT_ASSERT_EQUAL( unit, (unit+zero) );
     159
     160  unit += zero;
     161  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
     162  unit *= 1.;
     163  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
     164};
  • src/unittests/gslvectorunittest.hpp

    r13d5a9 r5f612ee  
    2222    CPPUNIT_TEST (CopyTest );
    2323    CPPUNIT_TEST (ExchangeTest );
     24    CPPUNIT_TEST (OperatorAlgebraTest );
     25    CPPUNIT_TEST (OperatorIsTest );
    2426    CPPUNIT_TEST_SUITE_END();
    2527
     
    3234    void CopyTest();
    3335    void ExchangeTest();
     36    void OperatorIsTest();
     37    void OperatorAlgebraTest();
    3438
    3539private:
  • src/unittests/logunittest.cpp

    r13d5a9 r5f612ee  
    4141{
    4242  logger::getInstance().setVerbosity(2);
    43   Log() << Verbose(0) << "Verbosity level is set to 2." << endl;
    44   Log() << Verbose(0) << "Test level 0" << endl;
    45   Log() << Verbose(1) << "Test level 1" << endl;
    46   Log() << Verbose(2) << "Test level 2" << endl;
    47   Log() << Verbose(3) << "Test level 3" << endl;
    48   Log() << Verbose(4) << "Test level 4" << endl;
     43  DoLog(0) && (Log() << Verbose(0) << "Verbosity level is set to 2." << endl);
     44  DoLog(0) && (Log() << Verbose(0) << "Test level 0" << endl);
     45  DoLog(1) && (Log() << Verbose(1) << "Test level 1" << endl);
     46  DoLog(2) && (Log() << Verbose(2) << "Test level 2" << endl);
     47  DoLog(3) && (Log() << Verbose(3) << "Test level 3" << endl);
     48  DoLog(4) && (Log() << Verbose(4) << "Test level 4" << endl);
    4949
    50   Log() << Verbose(0) << "Output a log message." << endl;
    51   eLog() << Verbose(0) << "Output an error message." << endl;
     50  DoLog(0) && (Log() << Verbose(0) << "Output a log message." << endl);
     51  DoeLog(0) && (eLog()<< Verbose(0) << "Output an error message." << endl);
    5252  setVerbosity(3);
    53   Log() << Verbose(4) << "This should not be printed." << endl;
    54   eLog() << Verbose(4) << "This should not be printed." << endl;
     53  DoLog(4) && (Log() << Verbose(4) << "This should not be printed." << endl);
     54  DoeLog(4) && (eLog()<< Verbose(4) << "This should not be printed." << endl);
    5555};
  • src/unittests/memoryallocatorunittest.cpp

    r13d5a9 r5f612ee  
    5252  char* buffer3 = NULL;
    5353  buffer3 = Malloc<char>(4, "");
    54   Log() << Verbose(0) << buffer3 << endl;
     54  DoLog(0) && (Log() << Verbose(0) << buffer3 << endl);
    5555  Free(&buffer3);
    5656
  • src/unittests/tesselation_boundarytriangleunittest.hpp

    r13d5a9 r5f612ee  
    3636      class BoundaryPointSet *points[3];
    3737      class TesselPoint *tesselpoints[3];
    38       LinkedNodes Corners;
     38      LinkedCell::LinkedNodes Corners;
    3939};
    4040
  • src/unittests/tesselation_insideoutsideunittest.cpp

    r13d5a9 r5f612ee  
    9898  while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) {
    9999    // 2a. fill all new OpenLines
    100     Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
     100    DoLog(1) && (Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl);
    101101    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
    102       Log() << Verbose(2) << *(Runner->second) << endl;
     102      DoLog(2) && (Log() << Verbose(2) << *(Runner->second) << endl);
    103103
    104104    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     
    106106      if (baseline->pointlist.empty()) {
    107107        T = (((baseline->BaseLine->triangles.begin()))->second);
    108         Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl;
     108        DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl);
    109109        TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, SPHERERADIUS, LinkedList); //the line is there, so there is a triangle, but only one.
    110110      }
     
    113113    // 2b. search for smallest ShortestAngle among all candidates
    114114    double ShortestAngle = 4.*M_PI;
    115     Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
     115    DoLog(1) && (Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl);
    116116    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
    117       Log() << Verbose(2) << *(Runner->second) << endl;
     117      DoLog(2) && (Log() << Verbose(2) << *(Runner->second) << endl);
    118118
    119119    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     
    127127      OneLoopWithoutSuccessFlag = false;
    128128    else {
    129       TesselStruct->AddCandidateTriangle(*baseline);
     129      TesselStruct->AddCandidatePolygon(*baseline, SPHERERADIUS, LinkedList);
    130130    }
    131131  }
     
    137137  delete(LinkedList);
    138138  delete(TesselStruct);
    139   for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
     139  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    140140    delete((*Runner)->node);
    141141    delete(*Runner);
  • src/unittests/tesselation_insideoutsideunittest.hpp

    r13d5a9 r5f612ee  
    3131private:
    3232      class Tesselation *TesselStruct;
    33       LinkedNodes Corners;
     33      LinkedCell::LinkedNodes Corners;
    3434      class LinkedCell *LinkedList;
    3535};
  • src/unittests/tesselationunittest.cpp

    r13d5a9 r5f612ee  
    9595      OneLoopWithoutSuccessFlag = false;
    9696    else {
    97       TesselStruct->AddCandidateTriangle(*baseline);
     97      TesselStruct->AddCandidatePolygon(*baseline, SPHERERADIUS, LinkedList);
    9898    }
    9999  }
     
    105105  delete(LinkedList);
    106106  delete(TesselStruct);
    107   for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
     107  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    108108    delete((*Runner)->node);
    109109    delete(*Runner);
  • src/unittests/tesselationunittest.hpp

    r13d5a9 r5f612ee  
    3434private:
    3535      class Tesselation *TesselStruct;
    36       LinkedNodes Corners;
     36      LinkedCell::LinkedNodes Corners;
    3737      class LinkedCell *LinkedList;
    3838};
Note: See TracChangeset for help on using the changeset viewer.