Changeset a1510d for src/unittests


Ignore:
Timestamp:
Feb 26, 2010, 1:57:01 PM (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:
a28a83, dbb474
Parents:
1f2217 (diff), e6fdbe (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 'FreddiesRefactoring' into StructureRefactoring

Conflicts:

molecuilder/src/Patterns/Observer.cpp
molecuilder/src/World.cpp
molecuilder/src/boundary.cpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/unittests/AnalysisCorrelationToPointUnitTest.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/AnalysisPairCorrelationUnitTest.cpp
molecuilder/src/unittests/Makefile.am
molecuilder/src/unittests/bondgraphunittest.cpp
molecuilder/src/unittests/listofbondsunittest.cpp

Location:
src/unittests
Files:
2 added
28 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/ActOnAllUnitTest.cpp

    r1f2217 ra1510d  
    1616#include "memoryallocator.hpp"
    1717#include "vector.hpp"
     18
     19#ifdef HAVE_TESTRUNNER
     20#include "UnitTestMain.hpp"
     21#endif /*HAVE_TESTRUNNER*/
    1822
    1923/********************************************** Test classes **************************************/
     
    4044{
    4145  VL.EmptyList();
     46  // Ref was copy constructed, hence has to be cleaned, too!
     47  Ref.EmptyList();
     48  MemoryUsageObserver::purgeInstance();
    4249};
    4350
     
    8895  VL.ActOnAll( (void (Vector::*)(const double ** const)) &Vector::Scale, (const double ** const)&inverses );
    8996  CPPUNIT_ASSERT_EQUAL( VL == Ref , true );
     97  Free(factors);
     98  Free(inverses);
    9099};
    91100
     
    108117  }
    109118};
    110 
    111 
    112 /********************************************** Main routine **************************************/
    113 
    114 int main(int argc, char **argv)
    115 {
    116   // Get the top level suite from the registry
    117   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    118 
    119   // Adds the test to the list of test to run
    120   CppUnit::TextUi::TestRunner runner;
    121   runner.addTest( suite );
    122 
    123   // Change the default outputter to a compiler error format outputter
    124   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    125                                                        std::cerr ) );
    126   // Run the tests.
    127   bool wasSucessful = runner.run();
    128 
    129   // Return error code 1 if the one of test failed.
    130   return wasSucessful ? 0 : 1;
    131 };
  • src/unittests/ActionSequenceTest.cpp

    r1f2217 ra1510d  
    1313#include "Actions/Action.hpp"
    1414#include "Actions/ActionSequence.hpp"
     15
     16#ifdef HAVE_TESTRUNNER
     17#include "UnitTestMain.hpp"
     18#endif /*HAVE_TESTRUNNER*/
     19
     20/********************************************** Test classes **************************************/
    1521
    1622// Registers the fixture into the 'registry'
     
    169175  CPPUNIT_ASSERT_EQUAL(false,shouldNotCall2->wasCalled());
    170176
     177  delete sequence;
    171178}
    172179
     
    190197  CPPUNIT_ASSERT_EQUAL(false,shouldNotCall2->wasCalled());
    191198
    192 }
    193 
    194 
    195 /********************************************** Main routine **************************************/
    196 
    197 int main(int argc, char **argv)
    198 {
    199   // Get the top level suite from the registry
    200   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    201 
    202   // Adds the test to the list of test to run
    203   CppUnit::TextUi::TestRunner runner;
    204   runner.addTest( suite );
    205 
    206   // Change the default outputter to a compiler error format outputter
    207   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    208                                                        std::cerr ) );
    209   // Run the tests.
    210   bool wasSucessful = runner.run();
    211 
    212   // Return error code 1 if the one of test failed.
    213   return wasSucessful ? 0 : 1;
    214 };
     199  delete sequence;
     200}
     201
     202
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r1f2217 ra1510d  
    2525#include "periodentafel.hpp"
    2626#include "tesselation.hpp"
     27#include "World.hpp"
     28
     29#ifdef HAVE_TESTRUNNER
     30#include "UnitTestMain.hpp"
     31#endif /*HAVE_TESTRUNNER*/
    2732
    2833/********************************************** Test classes **************************************/
     
    100105  delete(point);
    101106  World::destroy();
     107  MemoryUsageObserver::purgeInstance();
     108  logger::purgeInstance();
    102109};
    103110
     
    137144
    138145};
    139 
    140 /********************************************** Main routine **************************************/
    141 
    142 int main(int argc, char **argv)
    143 {
    144   // Get the top level suite from the registry
    145   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    146 
    147   // Adds the test to the list of test to run
    148   CppUnit::TextUi::TestRunner runner;
    149   runner.addTest( suite );
    150 
    151   // Change the default outputter to a compiler error format outputter
    152   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    153                                                        std::cerr ) );
    154   // Run the tests.
    155   bool wasSucessful = runner.run();
    156 
    157   // Return error code 1 if the one of test failed.
    158   return wasSucessful ? 0 : 1;
    159 };
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r1f2217 ra1510d  
    2525#include "periodentafel.hpp"
    2626#include "tesselation.hpp"
     27#include "World.hpp"
     28
     29#ifdef HAVE_TESTRUNNER
     30#include "UnitTestMain.hpp"
     31#endif /*HAVE_TESTRUNNER*/
    2732
    2833/********************************************** Test classes **************************************/
     
    131136  delete(LC);
    132137  World::destroy();
     138  MemoryUsageObserver::purgeInstance();
     139  logger::purgeInstance();
    133140};
    134141
     
    209216
    210217};
    211 
    212 /********************************************** Main routine **************************************/
    213 
    214 int main(int argc, char **argv)
    215 {
    216   // Get the top level suite from the registry
    217   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    218 
    219   // Adds the test to the list of test to run
    220   CppUnit::TextUi::TestRunner runner;
    221   runner.addTest( suite );
    222 
    223   // Change the default outputter to a compiler error format outputter
    224   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    225                                                        std::cerr ) );
    226   // Run the tests.
    227   bool wasSucessful = runner.run();
    228 
    229   // Return error code 1 if the one of test failed.
    230   return wasSucessful ? 0 : 1;
    231 };
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    r1f2217 ra1510d  
    2525#include "periodentafel.hpp"
    2626#include "tesselation.hpp"
     27#include "World.hpp"
     28
     29#ifdef HAVE_TESTRUNNER
     30#include "UnitTestMain.hpp"
     31#endif /*HAVE_TESTRUNNER*/
    2732
    2833/********************************************** Test classes **************************************/
     
    96101  // note that all the atoms are cleaned by TestMolecule
    97102  World::destroy();
     103  MemoryUsageObserver::purgeInstance();
     104  logger::purgeInstance();
     105  errorLogger::purgeInstance();
    98106};
    99107
     
    130138  CPPUNIT_ASSERT_EQUAL( 6, tester->second );
    131139};
    132 
    133 /********************************************** Main routine **************************************/
    134 
    135 int main(int argc, char **argv)
    136 {
    137   // Get the top level suite from the registry
    138   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    139 
    140   // Adds the test to the list of test to run
    141   CppUnit::TextUi::TestRunner runner;
    142   runner.addTest( suite );
    143 
    144   // Change the default outputter to a compiler error format outputter
    145   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    146                                                        std::cerr ) );
    147   // Run the tests.
    148   bool wasSucessful = runner.run();
    149 
    150   // Return error code 1 if the one of test failed.
    151   return wasSucessful ? 0 : 1;
    152 };
  • src/unittests/CacheableTest.cpp

    r1f2217 ra1510d  
    1515
    1616#include "Patterns/Cacheable.hpp"
     17
     18#ifdef HAVE_TESTRUNNER
     19#include "UnitTestMain.hpp"
     20#endif /*HAVE_TESTRUNNER*/
     21
     22/********************************************** Test classes **************************************/
    1723
    1824// Registers the fixture into the 'registry'
     
    7783  CPPUNIT_ASSERT_EQUAL( true, numbers->hasRecalced);
    7884}
    79 
    80 
    81 
    82 /********************************************** Main routine **************************************/
    83 
    84 int main(int argc, char **argv)
    85 {
    86   // Get the top level suite from the registry
    87   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    88 
    89   // Adds the test to the list of test to run
    90   CppUnit::TextUi::TestRunner runner;
    91   runner.addTest( suite );
    92 
    93   // Change the default outputter to a compiler error format outputter
    94   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    95                                                        std::cerr ) );
    96   // Run the tests.
    97   bool wasSucessful = runner.run();
    98 
    99   // Return error code 1 if the one of test failed.
    100   return wasSucessful ? 0 : 1;
    101 };
    102 
  • src/unittests/DescriptorUnittest.cpp

    r1f2217 ra1510d  
    1919#include "atom.hpp"
    2020
     21#ifdef HAVE_TESTRUNNER
     22#include "UnitTestMain.hpp"
     23#endif /*HAVE_TESTRUNNER*/
     24
     25/********************************************** Test classes **************************************/
    2126// Registers the fixture into the 'registry'
    2227CPPUNIT_TEST_SUITE_REGISTRATION( DescriptorUnittest );
     
    152157  }
    153158}
    154 
    155 /********************************************** Main routine **************************************/
    156 
    157 int main(int argc, char **argv)
    158 {
    159   // Get the top level suite from the registry
    160   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    161 
    162   // Adds the test to the list of test to run
    163   CppUnit::TextUi::TestRunner runner;
    164   runner.addTest( suite );
    165 
    166   // Change the default outputter to a compiler error format outputter
    167   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    168                                                        std::cerr ) );
    169   // Run the tests.
    170   bool wasSucessful = runner.run();
    171 
    172   // Return error code 1 if the one of test failed.
    173   return wasSucessful ? 0 : 1;
    174 };
  • src/unittests/Makefile.am

    r1f2217 ra1510d  
    3838 
    3939check_PROGRAMS = $(TESTS)
    40 noinst_PROGRAMS = $(TESTS)
     40noinst_PROGRAMS = $(TESTS) TestRunner
    4141
    4242GSLLIBS = ../libgslwrapper.a
    4343ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
    4444
    45 ActOnAllUnitTest_SOURCES = ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
     45TESTSOURCES = \
     46  ActOnAllUnitTest.cpp \
     47  analysisbondsunittest.cpp \
     48  AnalysisCorrelationToPointUnitTest.cpp \
     49  AnalysisCorrelationToSurfaceUnitTest.cpp  \
     50  AnalysisPairCorrelationUnitTest.cpp \
     51  bondgraphunittest.cpp \
     52  gslmatrixsymmetricunittest.cpp \
     53  gslmatrixunittest.cpp \
     54  gslvectorunittest.cpp \
     55  infounittest.cpp \
     56  linearsystemofequationsunittest.cpp \
     57  listofbondsunittest.cpp \
     58  logunittest.cpp \
     59  memoryallocatorunittest.cpp  \
     60  memoryusageobserverunittest.cpp \
     61  stackclassunittest.cpp \
     62  tesselationunittest.cpp \
     63  tesselation_boundarytriangleunittest.cpp \
     64  tesselation_insideoutsideunittest.cpp \
     65  vectorunittest.cpp \
     66  ObserverTest.cpp \
     67  CacheableTest.cpp \
     68  DescriptorUnittest.cpp \
     69  manipulateAtomsTest.cpp \
     70  atomsCalculationTest.cpp \
     71  ActionSequenceTest.cpp
     72
     73TESTHEADERS = \
     74  analysis_correlation.hpp
     75
     76ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
    4677ActOnAllUnitTest_LDADD = ${ALLLIBS}
    4778
    48 AnalysisBondsUnitTests_SOURCES = analysisbondsunittest.cpp analysisbondsunittest.hpp
     79AnalysisBondsUnitTests_SOURCES = UnitTestMain.cpp analysisbondsunittest.cpp analysisbondsunittest.hpp
    4980AnalysisBondsUnitTests_LDADD = ${ALLLIBS}
    5081
    51 AnalysisCorrelationToPointUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp
     82AnalysisCorrelationToPointUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp
    5283AnalysisCorrelationToPointUnitTest_LDADD = ${ALLLIBS}
    5384
    54 AnalysisCorrelationToSurfaceUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp
     85AnalysisCorrelationToSurfaceUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp
    5586AnalysisCorrelationToSurfaceUnitTest_LDADD = ${ALLLIBS}
    5687
    57 AnalysisPairCorrelationUnitTest_SOURCES = analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp
     88AnalysisPairCorrelationUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp
    5889AnalysisPairCorrelationUnitTest_LDADD = ${ALLLIBS}
    5990
    60 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp
     91BondGraphUnitTest_SOURCES = UnitTestMain.cpp bondgraphunittest.cpp bondgraphunittest.hpp
    6192BondGraphUnitTest_LDADD = ${ALLLIBS}
    6293
    63 GSLMatrixSymmetricUnitTest_SOURCES = gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp
     94GSLMatrixSymmetricUnitTest_SOURCES = UnitTestMain.cpp gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp
    6495GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS}
    6596
    66 GSLMatrixUnitTest_SOURCES = gslmatrixunittest.cpp gslmatrixunittest.hpp
     97GSLMatrixUnitTest_SOURCES = UnitTestMain.cpp gslmatrixunittest.cpp gslmatrixunittest.hpp
    6798GSLMatrixUnitTest_LDADD = ${GSLLIBS}
    6899
    69 GSLVectorUnitTest_SOURCES = gslvectorunittest.cpp gslvectorunittest.hpp
     100GSLVectorUnitTest_SOURCES = UnitTestMain.cpp gslvectorunittest.cpp gslvectorunittest.hpp
    70101GSLVectorUnitTest_LDADD = ${GSLLIBS}
    71102
    72 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp
     103InfoUnitTest_SOURCES = UnitTestMain.cpp infounittest.cpp infounittest.hpp
    73104InfoUnitTest_LDADD = ${ALLLIBS}
    74105
    75 LinearSystemOfEquationsUnitTest_SOURCES = linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp
     106LinearSystemOfEquationsUnitTest_SOURCES = UnitTestMain.cpp linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp
    76107LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}
    77108
    78 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp
     109ListOfBondsUnitTest_SOURCES = UnitTestMain.cpp listofbondsunittest.cpp listofbondsunittest.hpp
    79110ListOfBondsUnitTest_LDADD = ${ALLLIBS}
    80111
    81 LogUnitTest_SOURCES = logunittest.cpp logunittest.hpp
     112LogUnitTest_SOURCES = UnitTestMain.cpp logunittest.cpp logunittest.hpp
    82113LogUnitTest_LDADD = ${ALLLIBS}
    83114
    84 MemoryAllocatorUnitTest_SOURCES = memoryallocatorunittest.cpp memoryallocatorunittest.hpp
     115MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp
    85116MemoryAllocatorUnitTest_LDADD = ${ALLLIBS}
    86117
    87 MemoryUsageObserverUnitTest_SOURCES = memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp
     118MemoryUsageObserverUnitTest_SOURCES = UnitTestMain.cpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp
    88119MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS}
    89120
    90 StackClassUnitTest_SOURCES = stackclassunittest.cpp stackclassunittest.hpp
     121StackClassUnitTest_SOURCES = UnitTestMain.cpp stackclassunittest.cpp stackclassunittest.hpp
    91122StackClassUnitTest_LDADD = ${ALLLIBS}
    92123
    93 TesselationUnitTest_SOURCES = tesselationunittest.cpp tesselationunittest.hpp
     124TesselationUnitTest_SOURCES = UnitTestMain.cpp tesselationunittest.cpp tesselationunittest.hpp
    94125TesselationUnitTest_LDADD = ${ALLLIBS}
    95126
    96 Tesselation_BoundaryTriangleUnitTest_SOURCES = tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp
     127Tesselation_BoundaryTriangleUnitTest_SOURCES = UnitTestMain.cpp tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp
    97128Tesselation_BoundaryTriangleUnitTest_LDADD = ${ALLLIBS}
    98129
    99 Tesselation_InOutsideUnitTest_SOURCES = tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp
     130Tesselation_InOutsideUnitTest_SOURCES = UnitTestMain.cpp tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp
    100131Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS}
    101132
    102 VectorUnitTest_SOURCES = vectorunittest.cpp vectorunittest.hpp
     133VectorUnitTest_SOURCES = UnitTestMain.cpp vectorunittest.cpp vectorunittest.hpp
    103134VectorUnitTest_LDADD = ${ALLLIBS}
    104135
    105 ActionSequenceTest_SOURCES = ActionSequenceTest.cpp ActionSequenceTest.hpp
     136ActionSequenceTest_SOURCES = UnitTestMain.cpp ../../../TestRunnerClient.hpp ActionSequenceTest.cpp ActionSequenceTest.hpp
    106137ActionSequenceTest_LDADD = ${ALLLIBS}
    107138
    108 ObserverTest_SOURCES = ObserverTest.cpp ObserverTest.hpp
     139ObserverTest_SOURCES = UnitTestMain.cpp ObserverTest.cpp ObserverTest.hpp
    109140ObserverTest_LDADD = ${ALLLIBS}
    110141
    111 CacheableTest_SOURCES = CacheableTest.cpp CacheableTest.hpp
     142CacheableTest_SOURCES = UnitTestMain.cpp CacheableTest.cpp CacheableTest.hpp
    112143CacheableTest_LDADD = ${ALLLIBS}
    113144
    114 DescriptorUnittest_SOURCES = DescriptorUnittest.cpp DescriptorUnittest.hpp
     145DescriptorUnittest_SOURCES = UnitTestMain.cpp DescriptorUnittest.cpp DescriptorUnittest.hpp
    115146DescriptorUnittest_LDADD = ${ALLLIBS}
    116147
    117 manipulateAtomsTest_SOURCES = manipulateAtomsTest.cpp manipulateAtomsTest.hpp
     148manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp
    118149manipulateAtomsTest_LDADD = ${ALLLIBS}
    119150
    120 atomsCalculationTest_SOURCES = atomsCalculationTest.cpp atomsCalculationTest.hpp
     151atomsCalculationTest_SOURCES = UnitTestMain.cpp atomsCalculationTest.cpp atomsCalculationTest.hpp
    121152atomsCalculationTest_LDADD = ${ALLLIBS}
     153
     154TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS)
     155TestRunner_LDADD = ${ALLLIBS}
    122156
    123157#AUTOMAKE_OPTIONS = parallel-tests
  • src/unittests/ObserverTest.cpp

    r1f2217 ra1510d  
    1717
    1818using namespace std;
     19
     20#ifdef HAVE_TESTRUNNER
     21#include "UnitTestMain.hpp"
     22#endif /*HAVE_TESTRUNNER*/
    1923
    2024// Registers the fixture into the 'registry'
     
    4044  void changeMethod() {
    4145    OBSERVE;
    42     int i;
     46    int i = 0;
    4347    i++;
    4448  }
     
    4953  void changeMethod1() {
    5054    OBSERVE;
    51     int i;
     55    int i = 0;
    5256    i++;
    5357  }
     
    5559  void changeMethod2() {
    5660    OBSERVE;
    57     int i;
     61    int i = 0;
    5862    i++;
    5963    changeMethod1();
     
    7276  void changeMethod() {
    7377    OBSERVE;
    74     int i;
     78    int i = 0;
    7579    i++;
    7680    subObservable->changeMethod();
     
    110114  simpleObservable1->signOn(observer2);
    111115  simpleObservable1->signOn(observer3);
     116
    112117  simpleObservable2->signOn(observer2);
    113118  simpleObservable2->signOn(observer4);
     
    181186  CPPUNIT_ASSERT(true);
    182187}
    183 
    184 /********************************************** Main routine **************************************/
    185 
    186 int main(int argc, char **argv)
    187 {
    188   // Get the top level suite from the registry
    189   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    190 
    191   // Adds the test to the list of test to run
    192   CppUnit::TextUi::TestRunner runner;
    193   runner.addTest( suite );
    194 
    195   // Change the default outputter to a compiler error format outputter
    196   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    197                                                        std::cerr ) );
    198   // Run the tests.
    199   bool wasSucessful = runner.run();
    200 
    201   // Return error code 1 if the one of test failed.
    202   return wasSucessful ? 0 : 1;
    203 };
  • src/unittests/analysisbondsunittest.cpp

    r1f2217 ra1510d  
    2525#include "molecule.hpp"
    2626#include "periodentafel.hpp"
     27
     28#ifdef HAVE_TESTRUNNER
     29#include "UnitTestMain.hpp"
     30#endif /*HAVE_TESTRUNNER*/
    2731
    2832/********************************************** Test classes **************************************/
     
    163167  CPPUNIT_ASSERT_EQUAL( 0. , Max );
    164168};
    165 
    166 
    167 /********************************************** Main routine **************************************/
    168 
    169 int main(int argc, char **argv)
    170 {
    171   // Get the top level suite from the registry
    172   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    173 
    174   // Adds the test to the list of test to run
    175   CppUnit::TextUi::TestRunner runner;
    176   runner.addTest( suite );
    177 
    178   // Change the default outputter to a compiler error format outputter
    179   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    180                                                        std::cerr ) );
    181   // Run the tests.
    182   bool wasSucessful = runner.run();
    183 
    184   // Return error code 1 if the one of test failed.
    185   return wasSucessful ? 0 : 1;
    186 };
  • src/unittests/atomsCalculationTest.cpp

    r1f2217 ra1510d  
    6363
    6464// some helper functions
    65 bool hasAll(std::vector<int> ids,int min, int max, std::set<int> excluded = std::set<int>()){
     65static bool hasAll(std::vector<int> ids,int min, int max, std::set<int> excluded = std::set<int>()){
    6666  for(int i=min;i<max;++i){
    6767    if(!excluded.count(i)){
     
    8080}
    8181
    82 bool hasNoDuplicates(std::vector<int> ids){
     82static bool hasNoDuplicates(std::vector<int> ids){
    8383  std::set<int> found;
    8484  std::vector<int>::iterator iter;
     
    9292}
    9393
    94 void operation(atom* _atom){
     94static void operation(atom* _atom){
    9595  AtomStub *atom = dynamic_cast<AtomStub*>(_atom);
    9696  assert(atom);
     
    116116  CPPUNIT_ASSERT_EQUAL((size_t)(ATOM_COUNT-1),allIds.size());
    117117}
    118 
    119 /********************************************** Main routine **************************************/
    120 
    121 int main(int argc, char **argv)
    122 {
    123   // Get the top level suite from the registry
    124   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    125 
    126   // Adds the test to the list of test to run
    127   CppUnit::TextUi::TestRunner runner;
    128   runner.addTest( suite );
    129 
    130   // Change the default outputter to a compiler error format outputter
    131   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    132                                                        std::cerr ) );
    133   // Run the tests.
    134   bool wasSucessful = runner.run();
    135 
    136   // Return error code 1 if the one of test failed.
    137   return wasSucessful ? 0 : 1;
    138 };
  • src/unittests/bondgraphunittest.cpp

    r1f2217 ra1510d  
    2424#include "periodentafel.hpp"
    2525#include "bondgraphunittest.hpp"
     26#include "World.hpp"
     27
     28#ifdef HAVE_TESTRUNNER
     29#include "UnitTestMain.hpp"
     30#endif /*HAVE_TESTRUNNER*/
    2631
    2732/********************************************** Test classes **************************************/
     
    98103  // remove molecule
    99104  World::get()->destroyMolecule(TestMolecule);
    100   // note that all the atoms are cleaned by TestMolecule
     105  // note that all the atoms, molecules, the tafel and the elements
     106  // are all cleaned when the world is destroyed
    101107  World::destroy();
     108  MemoryUsageObserver::purgeInstance();
     109  logger::purgeInstance();
    102110};
    103111
     
    123131  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
    124132};
    125 
    126 
    127 /********************************************** Main routine **************************************/
    128 
    129 int main(int argc, char **argv)
    130 {
    131   // Get the top level suite from the registry
    132   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    133 
    134   // Adds the test to the list of test to run
    135   CppUnit::TextUi::TestRunner runner;
    136   runner.addTest( suite );
    137 
    138   // Change the default outputter to a compiler error format outputter
    139   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    140                                                        std::cerr ) );
    141   // Run the tests.
    142   bool wasSucessful = runner.run();
    143 
    144   // Return error code 1 if the one of test failed.
    145   return wasSucessful ? 0 : 1;
    146 };
  • src/unittests/gslmatrixsymmetricunittest.cpp

    r1f2217 ra1510d  
    1313
    1414#include "gslmatrixsymmetricunittest.hpp"
     15
     16#ifdef HAVE_TESTRUNNER
     17#include "UnitTestMain.hpp"
     18#endif /*HAVE_TESTRUNNER*/
    1519
    1620/********************************************** Test classes **************************************/
     
    266270  CPPUNIT_ASSERT_EQUAL( -26.5, m->Determinant() );
    267271};
    268 
    269 /********************************************** Main routine **************************************/
    270 
    271 int main(int argc, char **argv)
    272 {
    273   // Get the top level suite from the registry
    274   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    275 
    276   // Adds the test to the list of test to run
    277   CppUnit::TextUi::TestRunner runner;
    278   runner.addTest( suite );
    279 
    280   // Change the default outputter to a compiler error format outputter
    281   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    282                                                        std::cerr ) );
    283   // Run the tests.
    284   bool wasSucessful = runner.run();
    285 
    286   // Return error code 1 if the one of test failed.
    287   return wasSucessful ? 0 : 1;
    288 };
  • src/unittests/gslmatrixunittest.cpp

    r1f2217 ra1510d  
    1313
    1414#include "gslmatrixunittest.hpp"
     15
     16#ifdef HAVE_TESTRUNNER
     17#include "UnitTestMain.hpp"
     18#endif /*HAVE_TESTRUNNER*/
    1519
    1620/********************************************** Test classes **************************************/
     
    248252  CPPUNIT_ASSERT_EQUAL( false, m->IsPositiveDefinite() );
    249253};
    250 
    251 /********************************************** Main routine **************************************/
    252 
    253 int main(int argc, char **argv)
    254 {
    255   // Get the top level suite from the registry
    256   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    257 
    258   // Adds the test to the list of test to run
    259   CppUnit::TextUi::TestRunner runner;
    260   runner.addTest( suite );
    261 
    262   // Change the default outputter to a compiler error format outputter
    263   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    264                                                        std::cerr ) );
    265   // Run the tests.
    266   bool wasSucessful = runner.run();
    267 
    268   // Return error code 1 if the one of test failed.
    269   return wasSucessful ? 0 : 1;
    270 };
  • src/unittests/gslvectorunittest.cpp

    r1f2217 ra1510d  
    1313
    1414#include "gslvectorunittest.hpp"
     15
     16#ifdef HAVE_TESTRUNNER
     17#include "UnitTestMain.hpp"
     18#endif /*HAVE_TESTRUNNER*/
    1519
    1620/********************************************** Test classes **************************************/
     
    113117    CPPUNIT_ASSERT_EQUAL( (double)(3-j), v->Get(j) );
    114118};
    115 
    116 
    117 /********************************************** Main routine **************************************/
    118 
    119 int main(int argc, char **argv)
    120 {
    121   // Get the top level suite from the registry
    122   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    123 
    124   // Adds the test to the list of test to run
    125   CppUnit::TextUi::TestRunner runner;
    126   runner.addTest( suite );
    127 
    128   // Change the default outputter to a compiler error format outputter
    129   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    130                                                        std::cerr ) );
    131   // Run the tests.
    132   bool wasSucessful = runner.run();
    133 
    134   // Return error code 1 if the one of test failed.
    135   return wasSucessful ? 0 : 1;
    136 };
  • src/unittests/infounittest.cpp

    r1f2217 ra1510d  
    1717#include "info.hpp"
    1818#include "infounittest.hpp"
     19#include "log.hpp"
     20
     21#ifdef HAVE_TESTRUNNER
     22#include "UnitTestMain.hpp"
     23#endif /*HAVE_TESTRUNNER*/
    1924
    2025/********************************************** Test classes **************************************/
     
    3136void InfoTest::tearDown()
    3237{
     38  logger::purgeInstance();
    3339};
    3440
     
    4349  CPPUNIT_ASSERT_EQUAL( 1, test.verbosity );
    4450};
    45 
    46 
    47 /********************************************** Main routine **************************************/
    48 
    49 int main(int argc, char **argv)
    50 {
    51   // Get the top level suite from the registry
    52   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    53 
    54   // Adds the test to the list of test to run
    55   CppUnit::TextUi::TestRunner runner;
    56   runner.addTest( suite );
    57 
    58   // Change the default outputter to a compiler error format outputter
    59   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    60                                                        std::cerr ) );
    61   // Run the tests.
    62   bool wasSucessful = runner.run();
    63 
    64   // Return error code 1 if the one of test failed.
    65   return wasSucessful ? 0 : 1;
    66 };
  • src/unittests/linearsystemofequationsunittest.cpp

    r1f2217 ra1510d  
    1515#include "linearsystemofequationsunittest.hpp"
    1616#include "vector.hpp"
     17
     18#ifdef HAVE_TESTRUNNER
     19#include "UnitTestMain.hpp"
     20#endif /*HAVE_TESTRUNNER*/
    1721
    1822/********************************************** Test classes **************************************/
     
    103107  delete[](array);
    104108};
    105 
    106 /********************************************** Main routine **************************************/
    107 
    108 int main(int argc, char **argv)
    109 {
    110   // Get the top level suite from the registry
    111   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    112 
    113   // Adds the test to the list of test to run
    114   CppUnit::TextUi::TestRunner runner;
    115   runner.addTest( suite );
    116 
    117   // Change the default outputter to a compiler error format outputter
    118   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    119                                                        std::cerr ) );
    120   // Run the tests.
    121   bool wasSucessful = runner.run();
    122 
    123   // Return error code 1 if the one of test failed.
    124   return wasSucessful ? 0 : 1;
    125 };
  • src/unittests/listofbondsunittest.cpp

    r1f2217 ra1510d  
    2222#include "molecule.hpp"
    2323#include "periodentafel.hpp"
     24#include "World.hpp"
     25
     26#ifdef HAVE_TESTRUNNER
     27#include "UnitTestMain.hpp"
     28#endif /*HAVE_TESTRUNNER*/
    2429
    2530/********************************************** Test classes **************************************/
     
    7883  // remove
    7984  World::get()->destroyMolecule(TestMolecule);
    80   // note that all the atoms are cleaned by TestMolecule
     85  // note that all the atoms, molecules, the tafel and the elements
     86  // are all cleaned when the world is destroyed
    8187  World::destroy();
     88  MemoryUsageObserver::purgeInstance();
     89  logger::purgeInstance();
    8290};
    8391
     
    250258  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
    251259};
    252 
    253 /********************************************** Main routine **************************************/
    254 
    255 int main(int argc, char **argv)
    256 {
    257   // Get the top level suite from the registry
    258   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    259 
    260   // Adds the test to the list of test to run
    261   CppUnit::TextUi::TestRunner runner;
    262   runner.addTest( suite );
    263 
    264   // Change the default outputter to a compiler error format outputter
    265   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    266                                                        std::cerr ) );
    267   // Run the tests.
    268   bool wasSucessful = runner.run();
    269 
    270   // Return error code 1 if the one of test failed.
    271   return wasSucessful ? 0 : 1;
    272 };
  • src/unittests/logunittest.cpp

    r1f2217 ra1510d  
    1515#include "verbose.hpp"
    1616
     17#ifdef HAVE_TESTRUNNER
     18#include "UnitTestMain.hpp"
     19#endif /*HAVE_TESTRUNNER*/
     20
    1721/********************************************** Test classes **************************************/
    1822
     
    2731void LogTest::tearDown()
    2832{
     33  logger::purgeInstance();
     34  errorLogger::purgeInstance();
    2935};
    3036
     
    4854  eLog() << Verbose(4) << "This should not be printed." << endl;
    4955};
    50 
    51 
    52 /********************************************** Main routine **************************************/
    53 
    54 int main(int argc, char **argv)
    55 {
    56   // Get the top level suite from the registry
    57   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    58 
    59   // Adds the test to the list of test to run
    60   CppUnit::TextUi::TestRunner runner;
    61   runner.addTest( suite );
    62 
    63   // Change the default outputter to a compiler error format outputter
    64   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    65                                                        std::cerr ) );
    66   // Run the tests.
    67   bool wasSucessful = runner.run();
    68 
    69   // Return error code 1 if the one of test failed.
    70   return wasSucessful ? 0 : 1;
    71 };
  • src/unittests/manipulateAtomsTest.cpp

    r1f2217 ra1510d  
    7878
    7979// some helper functions
    80 bool hasAll(std::vector<atom*> atoms,int min, int max, std::set<int> excluded = std::set<int>()){
     80static bool hasAll(std::vector<atom*> atoms,int min, int max, std::set<int> excluded = std::set<int>()){
    8181  for(int i=min;i<max;++i){
    8282    if(!excluded.count(i)){
     
    9595}
    9696
    97 bool hasNoDuplicates(std::vector<atom*> atoms){
     97static bool hasNoDuplicates(std::vector<atom*> atoms){
    9898  std::set<int> found;
    9999  std::vector<atom*>::iterator iter;
     
    107107}
    108108
    109 void operation(atom* _atom){
     109static void operation(atom* _atom){
    110110  AtomStub *atom = dynamic_cast<AtomStub*>(_atom);
    111111  assert(atom);
     
    153153  delete obs;
    154154}
    155 
    156 /********************************************** Main routine **************************************/
    157 
    158 int main(int argc, char **argv)
    159 {
    160   // Get the top level suite from the registry
    161   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    162 
    163   // Adds the test to the list of test to run
    164   CppUnit::TextUi::TestRunner runner;
    165   runner.addTest( suite );
    166 
    167   // Change the default outputter to a compiler error format outputter
    168   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    169                                                        std::cerr ) );
    170   // Run the tests.
    171   bool wasSucessful = runner.run();
    172 
    173   // Return error code 1 if the one of test failed.
    174   return wasSucessful ? 0 : 1;
    175 };
  • src/unittests/memoryallocatorunittest.cpp

    r1f2217 ra1510d  
    1313#include "memoryallocatorunittest.hpp"
    1414#include "helpers.hpp"
     15#include "log.hpp"
    1516#include "defs.hpp"
     17
     18#ifdef HAVE_TESTRUNNER
     19#include "UnitTestMain.hpp"
     20#endif /*HAVE_TESTRUNNER*/
    1621
    1722/********************************************** Test classes **************************************/
     
    2934{
    3035  MemoryUsageObserver::getInstance()->purgeInstance();
     36  logger::purgeInstance();
    3137};
    3238
     
    102108  Free(buffer2);
    103109};
    104 
    105 
    106 /********************************************** Main routine **************************************/
    107 
    108 int main(int argc, char **argv)
    109 {
    110   // Get the top level suite from the registry
    111   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    112 
    113   // Adds the test to the list of test to run
    114   CppUnit::TextUi::TestRunner runner;
    115   runner.addTest( suite );
    116 
    117   // Change the default outputter to a compiler error format outputter
    118   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    119                                                        std::cerr ) );
    120   // Run the tests.
    121   bool wasSucessful = runner.run();
    122 
    123   // Return error code 1 if the one of test failed.
    124   return wasSucessful ? 0 : 1;
    125 };
  • src/unittests/memoryusageobserverunittest.cpp

    r1f2217 ra1510d  
    1414#include "memoryusageobserverunittest.hpp"
    1515
     16#ifdef HAVE_TESTRUNNER
     17#include "UnitTestMain.hpp"
     18#endif /*HAVE_TESTRUNNER*/
     19
    1620/********************************************** Test classes **************************************/
    1721// Registers the fixture into the 'registry'
     
    2731{
    2832  MemoryUsageObserver::purgeInstance();
     33  logger::purgeInstance();
     34  errorLogger::purgeInstance();
    2935};
    3036
     
    7076  MemoryUsageObserver::getInstance()->removeMemory(i);
    7177  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
     78  Free(i);
    7279};
    7380
     
    8087  MemoryUsageObserver::getInstance()->removeMemory(i);
    8188  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
     89  Free(i);
    8290};
    8391
     
    92100  MemoryUsageObserver::getInstance()->addMemory(j, sizeof(int));
    93101  CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
     102  Free(i);
     103  Free(j);
    94104};
    95105
     
    103113  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
    104114  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
     115  Free(i);
    105116};
    106117
     
    114125  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
    115126  CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory());
     127  Free(i);
    116128};
    117129
     
    125137  MemoryUsageObserver::getInstance()->removeMemory(i);
    126138  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory());
     139  Free(i);
    127140};
    128141
     
    135148  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
    136149  CPPUNIT_ASSERT_EQUAL(i, (int*) MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory().begin()->first);
     150  Free(i);
    137151};
    138 
    139 
    140 /********************************************** Main routine **************************************/
    141 
    142 int main(int argc, char **argv)
    143 {
    144   // Get the top level suite from the registry
    145   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    146 
    147   // Adds the test to the list of test to run
    148   CppUnit::TextUi::TestRunner runner;
    149   runner.addTest( suite );
    150 
    151   // Change the default outputter to a compiler error format outputter
    152   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    153                                                        std::cerr ) );
    154   // Run the tests.
    155   bool wasSucessful = runner.run();
    156 
    157   // Return error code 1 if the one of test failed.
    158   return wasSucessful ? 0 : 1;
    159 };
  • src/unittests/stackclassunittest.cpp

    r1f2217 ra1510d  
    1414#include "stackclassunittest.hpp"
    1515#include "log.hpp"
     16
     17#ifdef HAVE_TESTRUNNER
     18#include "UnitTestMain.hpp"
     19#endif /*HAVE_TESTRUNNER*/
    1620
    1721enum { testdimension=3 };
     
    3337  Stack->ClearStack();
    3438  delete(Stack);
     39  MemoryUsageObserver::purgeInstance();
     40  logger::purgeInstance();
    3541};
    3642
     
    6773  CPPUNIT_ASSERT_EQUAL(0, Stack->ItemCount());
    6874};
    69 
    70 
    71 /********************************************** Main routine **************************************/
    72 
    73 int main(int argc, char **argv)
    74 {
    75   // Get the top level suite from the registry
    76   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    77 
    78   // Adds the test to the list of test to run
    79   CppUnit::TextUi::TestRunner runner;
    80   runner.addTest( suite );
    81 
    82   // Change the default outputter to a compiler error format outputter
    83   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    84                                                        std::cerr ) );
    85   // Run the tests.
    86   bool wasSucessful = runner.run();
    87 
    88   // Return error code 1 if the one of test failed.
    89   return wasSucessful ? 0 : 1;
    90 };
  • src/unittests/tesselation_boundarytriangleunittest.cpp

    r1f2217 ra1510d  
    1818#include "tesselation_boundarytriangleunittest.hpp"
    1919
     20#ifdef HAVE_TESTRUNNER
     21#include "UnitTestMain.hpp"
     22#endif /*HAVE_TESTRUNNER*/
     23
    2024#define SPHERERADIUS 2.
    2125
     
    3135
    3236  // create nodes
    33   TesselPoint *Walker = NULL;
    34   Walker = new TesselPoint;
    35   Walker->node = new Vector(0., 0., 0.);
    36   Walker->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
    37   strcpy(Walker->Name, "1");
    38   Walker->nr = 1;
    39   points[0] = new BoundaryPointSet(Walker);
    40   Walker = new TesselPoint;
    41   Walker->node = new Vector(0., 1., 0.);
    42   Walker->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
    43   strcpy(Walker->Name, "2");
    44   Walker->nr = 2;
    45   points[1] = new BoundaryPointSet(Walker);
    46   Walker = new TesselPoint;
    47   Walker->node = new Vector(1., 0., 0.);
    48   Walker->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
    49   strcpy(Walker->Name, "3");
    50   Walker->nr = 3;
    51   points[2] = new BoundaryPointSet(Walker);
     37  tesselpoints[0] = new TesselPoint;
     38  tesselpoints[0]->node = new Vector(0., 0., 0.);
     39  tesselpoints[0]->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
     40  strcpy(tesselpoints[0]->Name, "1");
     41  tesselpoints[0]->nr = 1;
     42  points[0] = new BoundaryPointSet(tesselpoints[0]);
     43  tesselpoints[1] = new TesselPoint;
     44  tesselpoints[1]->node = new Vector(0., 1., 0.);
     45  tesselpoints[1]->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
     46  strcpy(tesselpoints[1]->Name, "2");
     47  tesselpoints[1]->nr = 2;
     48  points[1] = new BoundaryPointSet(tesselpoints[1]);
     49  tesselpoints[2] = new TesselPoint;
     50  tesselpoints[2] ->node = new Vector(1., 0., 0.);
     51  tesselpoints[2] ->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
     52  strcpy(tesselpoints[2] ->Name, "3");
     53  tesselpoints[2] ->nr = 3;
     54  points[2] = new BoundaryPointSet(tesselpoints[2] );
    5255
    5356  // create line
     
    6568{
    6669  delete(triangle);
     70  for (int i=0;i<3;++i) {
     71    // TesselPoint does not delete its vector as it only got a reference
     72    delete tesselpoints[i]->node;
     73    delete tesselpoints[i];
     74  }
    6775  MemoryUsageObserver::purgeInstance();
    6876  logger::purgeInstance();
     
    191199  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    192200};
    193 
    194 
    195 /********************************************** Main routine **************************************/
    196 
    197 int main(int argc, char **argv)
    198 {
    199   // Get the top level suite from the registry
    200   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    201 
    202   // Adds the test to the list of test to run
    203   CppUnit::TextUi::TestRunner runner;
    204   runner.addTest( suite );
    205 
    206   // Change the default outputter to a compiler error format outputter
    207   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    208                                                        std::cerr ) );
    209   // Run the tests.
    210   bool wasSucessful = runner.run();
    211 
    212   // Return error code 1 if the one of test failed.
    213   return wasSucessful ? 0 : 1;
    214 };
  • src/unittests/tesselation_boundarytriangleunittest.hpp

    r1f2217 ra1510d  
    3535      class BoundaryLineSet *lines[3];
    3636      class BoundaryPointSet *points[3];
     37      class TesselPoint *tesselpoints[3];
    3738      LinkedNodes Corners;
    3839};
  • src/unittests/tesselation_insideoutsideunittest.cpp

    r1f2217 ra1510d  
    1717#include "tesselation.hpp"
    1818#include "tesselation_insideoutsideunittest.hpp"
     19
     20#ifdef HAVE_TESTRUNNER
     21#include "UnitTestMain.hpp"
     22#endif /*HAVE_TESTRUNNER*/
    1923
    2024#define SPHERERADIUS 2.
     
    161165      }
    162166};
    163 
    164 /********************************************** Main routine **************************************/
    165 
    166 int main(int argc, char **argv)
    167 {
    168   // Get the top level suite from the registry
    169   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    170 
    171   // Adds the test to the list of test to run
    172   CppUnit::TextUi::TestRunner runner;
    173   runner.addTest( suite );
    174 
    175   // Change the default outputter to a compiler error format outputter
    176   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    177                                                        std::cerr ) );
    178   // Run the tests.
    179   bool wasSucessful = runner.run();
    180 
    181   // Return error code 1 if the one of test failed.
    182   return wasSucessful ? 0 : 1;
    183 };
  • src/unittests/tesselationunittest.cpp

    r1f2217 ra1510d  
    1818#include "tesselation.hpp"
    1919#include "tesselationunittest.hpp"
     20
     21#ifdef HAVE_TESTRUNNER
     22#include "UnitTestMain.hpp"
     23#endif /*HAVE_TESTRUNNER*/
    2024
    2125#define SPHERERADIUS 2.
     
    177181  }
    178182}
    179 
    180 /********************************************** Main routine **************************************/
    181 
    182 int main(int argc, char **argv)
    183 {
    184   // Get the top level suite from the registry
    185   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    186 
    187   // Adds the test to the list of test to run
    188   CppUnit::TextUi::TestRunner runner;
    189   runner.addTest( suite );
    190 
    191   // Change the default outputter to a compiler error format outputter
    192   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    193                                                        std::cerr ) );
    194   // Run the tests.
    195   bool wasSucessful = runner.run();
    196 
    197   // Return error code 1 if the one of test failed.
    198   return wasSucessful ? 0 : 1;
    199 };
  • src/unittests/vectorunittest.cpp

    r1f2217 ra1510d  
    1414
    1515#include "defs.hpp"
     16#include "log.hpp"
     17#include "memoryusageobserver.hpp"
    1618#include "vector.hpp"
    1719#include "vectorunittest.hpp"
     20
     21#ifdef HAVE_TESTRUNNER
     22#include "UnitTestMain.hpp"
     23#endif /*HAVE_TESTRUNNER*/
    1824
    1925/********************************************** Test classes **************************************/
     
    3541void VectorTest::tearDown()
    3642{
     43  MemoryUsageObserver::purgeInstance();
     44  logger::purgeInstance();
     45  errorLogger::purgeInstance();
    3746};
    3847
     
    290299}
    291300
    292 
    293 /********************************************** Main routine **************************************/
    294 
    295 int main(int argc, char **argv)
    296 {
    297   // Get the top level suite from the registry
    298   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    299 
    300   // Adds the test to the list of test to run
    301   CppUnit::TextUi::TestRunner runner;
    302   runner.addTest( suite );
    303 
    304   // Change the default outputter to a compiler error format outputter
    305   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    306                                                        std::cerr ) );
    307   // Run the tests.
    308   bool wasSucessful = runner.run();
    309 
    310   // Return error code 1 if the one of test failed.
    311   return wasSucessful ? 0 : 1;
    312 };
Note: See TracChangeset for help on using the changeset viewer.