Changeset a1510d for src/unittests
- Timestamp:
- Feb 26, 2010, 1:57:01 PM (15 years ago)
- 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. - Location:
- src/unittests
- Files:
-
- 2 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/ActOnAllUnitTest.cpp
r1f2217 ra1510d 16 16 #include "memoryallocator.hpp" 17 17 #include "vector.hpp" 18 19 #ifdef HAVE_TESTRUNNER 20 #include "UnitTestMain.hpp" 21 #endif /*HAVE_TESTRUNNER*/ 18 22 19 23 /********************************************** Test classes **************************************/ … … 40 44 { 41 45 VL.EmptyList(); 46 // Ref was copy constructed, hence has to be cleaned, too! 47 Ref.EmptyList(); 48 MemoryUsageObserver::purgeInstance(); 42 49 }; 43 50 … … 88 95 VL.ActOnAll( (void (Vector::*)(const double ** const)) &Vector::Scale, (const double ** const)&inverses ); 89 96 CPPUNIT_ASSERT_EQUAL( VL == Ref , true ); 97 Free(factors); 98 Free(inverses); 90 99 }; 91 100 … … 108 117 } 109 118 }; 110 111 112 /********************************************** Main routine **************************************/113 114 int main(int argc, char **argv)115 {116 // Get the top level suite from the registry117 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();118 119 // Adds the test to the list of test to run120 CppUnit::TextUi::TestRunner runner;121 runner.addTest( suite );122 123 // Change the default outputter to a compiler error format outputter124 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 13 13 #include "Actions/Action.hpp" 14 14 #include "Actions/ActionSequence.hpp" 15 16 #ifdef HAVE_TESTRUNNER 17 #include "UnitTestMain.hpp" 18 #endif /*HAVE_TESTRUNNER*/ 19 20 /********************************************** Test classes **************************************/ 15 21 16 22 // Registers the fixture into the 'registry' … … 169 175 CPPUNIT_ASSERT_EQUAL(false,shouldNotCall2->wasCalled()); 170 176 177 delete sequence; 171 178 } 172 179 … … 190 197 CPPUNIT_ASSERT_EQUAL(false,shouldNotCall2->wasCalled()); 191 198 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 25 25 #include "periodentafel.hpp" 26 26 #include "tesselation.hpp" 27 #include "World.hpp" 28 29 #ifdef HAVE_TESTRUNNER 30 #include "UnitTestMain.hpp" 31 #endif /*HAVE_TESTRUNNER*/ 27 32 28 33 /********************************************** Test classes **************************************/ … … 100 105 delete(point); 101 106 World::destroy(); 107 MemoryUsageObserver::purgeInstance(); 108 logger::purgeInstance(); 102 109 }; 103 110 … … 137 144 138 145 }; 139 140 /********************************************** Main routine **************************************/141 142 int main(int argc, char **argv)143 {144 // Get the top level suite from the registry145 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();146 147 // Adds the test to the list of test to run148 CppUnit::TextUi::TestRunner runner;149 runner.addTest( suite );150 151 // Change the default outputter to a compiler error format outputter152 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 25 25 #include "periodentafel.hpp" 26 26 #include "tesselation.hpp" 27 #include "World.hpp" 28 29 #ifdef HAVE_TESTRUNNER 30 #include "UnitTestMain.hpp" 31 #endif /*HAVE_TESTRUNNER*/ 27 32 28 33 /********************************************** Test classes **************************************/ … … 131 136 delete(LC); 132 137 World::destroy(); 138 MemoryUsageObserver::purgeInstance(); 139 logger::purgeInstance(); 133 140 }; 134 141 … … 209 216 210 217 }; 211 212 /********************************************** Main routine **************************************/213 214 int main(int argc, char **argv)215 {216 // Get the top level suite from the registry217 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();218 219 // Adds the test to the list of test to run220 CppUnit::TextUi::TestRunner runner;221 runner.addTest( suite );222 223 // Change the default outputter to a compiler error format outputter224 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 25 25 #include "periodentafel.hpp" 26 26 #include "tesselation.hpp" 27 #include "World.hpp" 28 29 #ifdef HAVE_TESTRUNNER 30 #include "UnitTestMain.hpp" 31 #endif /*HAVE_TESTRUNNER*/ 27 32 28 33 /********************************************** Test classes **************************************/ … … 96 101 // note that all the atoms are cleaned by TestMolecule 97 102 World::destroy(); 103 MemoryUsageObserver::purgeInstance(); 104 logger::purgeInstance(); 105 errorLogger::purgeInstance(); 98 106 }; 99 107 … … 130 138 CPPUNIT_ASSERT_EQUAL( 6, tester->second ); 131 139 }; 132 133 /********************************************** Main routine **************************************/134 135 int main(int argc, char **argv)136 {137 // Get the top level suite from the registry138 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();139 140 // Adds the test to the list of test to run141 CppUnit::TextUi::TestRunner runner;142 runner.addTest( suite );143 144 // Change the default outputter to a compiler error format outputter145 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 15 15 16 16 #include "Patterns/Cacheable.hpp" 17 18 #ifdef HAVE_TESTRUNNER 19 #include "UnitTestMain.hpp" 20 #endif /*HAVE_TESTRUNNER*/ 21 22 /********************************************** Test classes **************************************/ 17 23 18 24 // Registers the fixture into the 'registry' … … 77 83 CPPUNIT_ASSERT_EQUAL( true, numbers->hasRecalced); 78 84 } 79 80 81 82 /********************************************** Main routine **************************************/83 84 int main(int argc, char **argv)85 {86 // Get the top level suite from the registry87 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();88 89 // Adds the test to the list of test to run90 CppUnit::TextUi::TestRunner runner;91 runner.addTest( suite );92 93 // Change the default outputter to a compiler error format outputter94 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 19 19 #include "atom.hpp" 20 20 21 #ifdef HAVE_TESTRUNNER 22 #include "UnitTestMain.hpp" 23 #endif /*HAVE_TESTRUNNER*/ 24 25 /********************************************** Test classes **************************************/ 21 26 // Registers the fixture into the 'registry' 22 27 CPPUNIT_TEST_SUITE_REGISTRATION( DescriptorUnittest ); … … 152 157 } 153 158 } 154 155 /********************************************** Main routine **************************************/156 157 int main(int argc, char **argv)158 {159 // Get the top level suite from the registry160 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();161 162 // Adds the test to the list of test to run163 CppUnit::TextUi::TestRunner runner;164 runner.addTest( suite );165 166 // Change the default outputter to a compiler error format outputter167 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 38 38 39 39 check_PROGRAMS = $(TESTS) 40 noinst_PROGRAMS = $(TESTS) 40 noinst_PROGRAMS = $(TESTS) TestRunner 41 41 42 42 GSLLIBS = ../libgslwrapper.a 43 43 ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB} 44 44 45 ActOnAllUnitTest_SOURCES = ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp 45 TESTSOURCES = \ 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 73 TESTHEADERS = \ 74 analysis_correlation.hpp 75 76 ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp 46 77 ActOnAllUnitTest_LDADD = ${ALLLIBS} 47 78 48 AnalysisBondsUnitTests_SOURCES = analysisbondsunittest.cpp analysisbondsunittest.hpp79 AnalysisBondsUnitTests_SOURCES = UnitTestMain.cpp analysisbondsunittest.cpp analysisbondsunittest.hpp 49 80 AnalysisBondsUnitTests_LDADD = ${ALLLIBS} 50 81 51 AnalysisCorrelationToPointUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp82 AnalysisCorrelationToPointUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp 52 83 AnalysisCorrelationToPointUnitTest_LDADD = ${ALLLIBS} 53 84 54 AnalysisCorrelationToSurfaceUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp85 AnalysisCorrelationToSurfaceUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp 55 86 AnalysisCorrelationToSurfaceUnitTest_LDADD = ${ALLLIBS} 56 87 57 AnalysisPairCorrelationUnitTest_SOURCES = analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp88 AnalysisPairCorrelationUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp 58 89 AnalysisPairCorrelationUnitTest_LDADD = ${ALLLIBS} 59 90 60 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp91 BondGraphUnitTest_SOURCES = UnitTestMain.cpp bondgraphunittest.cpp bondgraphunittest.hpp 61 92 BondGraphUnitTest_LDADD = ${ALLLIBS} 62 93 63 GSLMatrixSymmetricUnitTest_SOURCES = gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp94 GSLMatrixSymmetricUnitTest_SOURCES = UnitTestMain.cpp gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp 64 95 GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS} 65 96 66 GSLMatrixUnitTest_SOURCES = gslmatrixunittest.cpp gslmatrixunittest.hpp97 GSLMatrixUnitTest_SOURCES = UnitTestMain.cpp gslmatrixunittest.cpp gslmatrixunittest.hpp 67 98 GSLMatrixUnitTest_LDADD = ${GSLLIBS} 68 99 69 GSLVectorUnitTest_SOURCES = gslvectorunittest.cpp gslvectorunittest.hpp100 GSLVectorUnitTest_SOURCES = UnitTestMain.cpp gslvectorunittest.cpp gslvectorunittest.hpp 70 101 GSLVectorUnitTest_LDADD = ${GSLLIBS} 71 102 72 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp103 InfoUnitTest_SOURCES = UnitTestMain.cpp infounittest.cpp infounittest.hpp 73 104 InfoUnitTest_LDADD = ${ALLLIBS} 74 105 75 LinearSystemOfEquationsUnitTest_SOURCES = linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp106 LinearSystemOfEquationsUnitTest_SOURCES = UnitTestMain.cpp linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp 76 107 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS} 77 108 78 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp109 ListOfBondsUnitTest_SOURCES = UnitTestMain.cpp listofbondsunittest.cpp listofbondsunittest.hpp 79 110 ListOfBondsUnitTest_LDADD = ${ALLLIBS} 80 111 81 LogUnitTest_SOURCES = logunittest.cpp logunittest.hpp112 LogUnitTest_SOURCES = UnitTestMain.cpp logunittest.cpp logunittest.hpp 82 113 LogUnitTest_LDADD = ${ALLLIBS} 83 114 84 MemoryAllocatorUnitTest_SOURCES = memoryallocatorunittest.cpp memoryallocatorunittest.hpp115 MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp 85 116 MemoryAllocatorUnitTest_LDADD = ${ALLLIBS} 86 117 87 MemoryUsageObserverUnitTest_SOURCES = memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp118 MemoryUsageObserverUnitTest_SOURCES = UnitTestMain.cpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp 88 119 MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS} 89 120 90 StackClassUnitTest_SOURCES = stackclassunittest.cpp stackclassunittest.hpp121 StackClassUnitTest_SOURCES = UnitTestMain.cpp stackclassunittest.cpp stackclassunittest.hpp 91 122 StackClassUnitTest_LDADD = ${ALLLIBS} 92 123 93 TesselationUnitTest_SOURCES = tesselationunittest.cpp tesselationunittest.hpp124 TesselationUnitTest_SOURCES = UnitTestMain.cpp tesselationunittest.cpp tesselationunittest.hpp 94 125 TesselationUnitTest_LDADD = ${ALLLIBS} 95 126 96 Tesselation_BoundaryTriangleUnitTest_SOURCES = tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp127 Tesselation_BoundaryTriangleUnitTest_SOURCES = UnitTestMain.cpp tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp 97 128 Tesselation_BoundaryTriangleUnitTest_LDADD = ${ALLLIBS} 98 129 99 Tesselation_InOutsideUnitTest_SOURCES = tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp130 Tesselation_InOutsideUnitTest_SOURCES = UnitTestMain.cpp tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp 100 131 Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS} 101 132 102 VectorUnitTest_SOURCES = vectorunittest.cpp vectorunittest.hpp133 VectorUnitTest_SOURCES = UnitTestMain.cpp vectorunittest.cpp vectorunittest.hpp 103 134 VectorUnitTest_LDADD = ${ALLLIBS} 104 135 105 ActionSequenceTest_SOURCES = ActionSequenceTest.cpp ActionSequenceTest.hpp136 ActionSequenceTest_SOURCES = UnitTestMain.cpp ../../../TestRunnerClient.hpp ActionSequenceTest.cpp ActionSequenceTest.hpp 106 137 ActionSequenceTest_LDADD = ${ALLLIBS} 107 138 108 ObserverTest_SOURCES = ObserverTest.cpp ObserverTest.hpp139 ObserverTest_SOURCES = UnitTestMain.cpp ObserverTest.cpp ObserverTest.hpp 109 140 ObserverTest_LDADD = ${ALLLIBS} 110 141 111 CacheableTest_SOURCES = CacheableTest.cpp CacheableTest.hpp142 CacheableTest_SOURCES = UnitTestMain.cpp CacheableTest.cpp CacheableTest.hpp 112 143 CacheableTest_LDADD = ${ALLLIBS} 113 144 114 DescriptorUnittest_SOURCES = DescriptorUnittest.cpp DescriptorUnittest.hpp145 DescriptorUnittest_SOURCES = UnitTestMain.cpp DescriptorUnittest.cpp DescriptorUnittest.hpp 115 146 DescriptorUnittest_LDADD = ${ALLLIBS} 116 147 117 manipulateAtomsTest_SOURCES = manipulateAtomsTest.cpp manipulateAtomsTest.hpp148 manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp 118 149 manipulateAtomsTest_LDADD = ${ALLLIBS} 119 150 120 atomsCalculationTest_SOURCES = atomsCalculationTest.cpp atomsCalculationTest.hpp151 atomsCalculationTest_SOURCES = UnitTestMain.cpp atomsCalculationTest.cpp atomsCalculationTest.hpp 121 152 atomsCalculationTest_LDADD = ${ALLLIBS} 153 154 TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS) 155 TestRunner_LDADD = ${ALLLIBS} 122 156 123 157 #AUTOMAKE_OPTIONS = parallel-tests -
src/unittests/ObserverTest.cpp
r1f2217 ra1510d 17 17 18 18 using namespace std; 19 20 #ifdef HAVE_TESTRUNNER 21 #include "UnitTestMain.hpp" 22 #endif /*HAVE_TESTRUNNER*/ 19 23 20 24 // Registers the fixture into the 'registry' … … 40 44 void changeMethod() { 41 45 OBSERVE; 42 int i ;46 int i = 0; 43 47 i++; 44 48 } … … 49 53 void changeMethod1() { 50 54 OBSERVE; 51 int i ;55 int i = 0; 52 56 i++; 53 57 } … … 55 59 void changeMethod2() { 56 60 OBSERVE; 57 int i ;61 int i = 0; 58 62 i++; 59 63 changeMethod1(); … … 72 76 void changeMethod() { 73 77 OBSERVE; 74 int i ;78 int i = 0; 75 79 i++; 76 80 subObservable->changeMethod(); … … 110 114 simpleObservable1->signOn(observer2); 111 115 simpleObservable1->signOn(observer3); 116 112 117 simpleObservable2->signOn(observer2); 113 118 simpleObservable2->signOn(observer4); … … 181 186 CPPUNIT_ASSERT(true); 182 187 } 183 184 /********************************************** Main routine **************************************/185 186 int main(int argc, char **argv)187 {188 // Get the top level suite from the registry189 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();190 191 // Adds the test to the list of test to run192 CppUnit::TextUi::TestRunner runner;193 runner.addTest( suite );194 195 // Change the default outputter to a compiler error format outputter196 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 25 25 #include "molecule.hpp" 26 26 #include "periodentafel.hpp" 27 28 #ifdef HAVE_TESTRUNNER 29 #include "UnitTestMain.hpp" 30 #endif /*HAVE_TESTRUNNER*/ 27 31 28 32 /********************************************** Test classes **************************************/ … … 163 167 CPPUNIT_ASSERT_EQUAL( 0. , Max ); 164 168 }; 165 166 167 /********************************************** Main routine **************************************/168 169 int main(int argc, char **argv)170 {171 // Get the top level suite from the registry172 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();173 174 // Adds the test to the list of test to run175 CppUnit::TextUi::TestRunner runner;176 runner.addTest( suite );177 178 // Change the default outputter to a compiler error format outputter179 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 63 63 64 64 // some helper functions 65 bool hasAll(std::vector<int> ids,int min, int max, std::set<int> excluded = std::set<int>()){65 static bool hasAll(std::vector<int> ids,int min, int max, std::set<int> excluded = std::set<int>()){ 66 66 for(int i=min;i<max;++i){ 67 67 if(!excluded.count(i)){ … … 80 80 } 81 81 82 bool hasNoDuplicates(std::vector<int> ids){82 static bool hasNoDuplicates(std::vector<int> ids){ 83 83 std::set<int> found; 84 84 std::vector<int>::iterator iter; … … 92 92 } 93 93 94 void operation(atom* _atom){94 static void operation(atom* _atom){ 95 95 AtomStub *atom = dynamic_cast<AtomStub*>(_atom); 96 96 assert(atom); … … 116 116 CPPUNIT_ASSERT_EQUAL((size_t)(ATOM_COUNT-1),allIds.size()); 117 117 } 118 119 /********************************************** Main routine **************************************/120 121 int main(int argc, char **argv)122 {123 // Get the top level suite from the registry124 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();125 126 // Adds the test to the list of test to run127 CppUnit::TextUi::TestRunner runner;128 runner.addTest( suite );129 130 // Change the default outputter to a compiler error format outputter131 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 24 24 #include "periodentafel.hpp" 25 25 #include "bondgraphunittest.hpp" 26 #include "World.hpp" 27 28 #ifdef HAVE_TESTRUNNER 29 #include "UnitTestMain.hpp" 30 #endif /*HAVE_TESTRUNNER*/ 26 31 27 32 /********************************************** Test classes **************************************/ … … 98 103 // remove molecule 99 104 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 101 107 World::destroy(); 108 MemoryUsageObserver::purgeInstance(); 109 logger::purgeInstance(); 102 110 }; 103 111 … … 123 131 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) ); 124 132 }; 125 126 127 /********************************************** Main routine **************************************/128 129 int main(int argc, char **argv)130 {131 // Get the top level suite from the registry132 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();133 134 // Adds the test to the list of test to run135 CppUnit::TextUi::TestRunner runner;136 runner.addTest( suite );137 138 // Change the default outputter to a compiler error format outputter139 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 13 13 14 14 #include "gslmatrixsymmetricunittest.hpp" 15 16 #ifdef HAVE_TESTRUNNER 17 #include "UnitTestMain.hpp" 18 #endif /*HAVE_TESTRUNNER*/ 15 19 16 20 /********************************************** Test classes **************************************/ … … 266 270 CPPUNIT_ASSERT_EQUAL( -26.5, m->Determinant() ); 267 271 }; 268 269 /********************************************** Main routine **************************************/270 271 int main(int argc, char **argv)272 {273 // Get the top level suite from the registry274 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();275 276 // Adds the test to the list of test to run277 CppUnit::TextUi::TestRunner runner;278 runner.addTest( suite );279 280 // Change the default outputter to a compiler error format outputter281 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 13 13 14 14 #include "gslmatrixunittest.hpp" 15 16 #ifdef HAVE_TESTRUNNER 17 #include "UnitTestMain.hpp" 18 #endif /*HAVE_TESTRUNNER*/ 15 19 16 20 /********************************************** Test classes **************************************/ … … 248 252 CPPUNIT_ASSERT_EQUAL( false, m->IsPositiveDefinite() ); 249 253 }; 250 251 /********************************************** Main routine **************************************/252 253 int main(int argc, char **argv)254 {255 // Get the top level suite from the registry256 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();257 258 // Adds the test to the list of test to run259 CppUnit::TextUi::TestRunner runner;260 runner.addTest( suite );261 262 // Change the default outputter to a compiler error format outputter263 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 13 13 14 14 #include "gslvectorunittest.hpp" 15 16 #ifdef HAVE_TESTRUNNER 17 #include "UnitTestMain.hpp" 18 #endif /*HAVE_TESTRUNNER*/ 15 19 16 20 /********************************************** Test classes **************************************/ … … 113 117 CPPUNIT_ASSERT_EQUAL( (double)(3-j), v->Get(j) ); 114 118 }; 115 116 117 /********************************************** Main routine **************************************/118 119 int main(int argc, char **argv)120 {121 // Get the top level suite from the registry122 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();123 124 // Adds the test to the list of test to run125 CppUnit::TextUi::TestRunner runner;126 runner.addTest( suite );127 128 // Change the default outputter to a compiler error format outputter129 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 17 17 #include "info.hpp" 18 18 #include "infounittest.hpp" 19 #include "log.hpp" 20 21 #ifdef HAVE_TESTRUNNER 22 #include "UnitTestMain.hpp" 23 #endif /*HAVE_TESTRUNNER*/ 19 24 20 25 /********************************************** Test classes **************************************/ … … 31 36 void InfoTest::tearDown() 32 37 { 38 logger::purgeInstance(); 33 39 }; 34 40 … … 43 49 CPPUNIT_ASSERT_EQUAL( 1, test.verbosity ); 44 50 }; 45 46 47 /********************************************** Main routine **************************************/48 49 int main(int argc, char **argv)50 {51 // Get the top level suite from the registry52 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();53 54 // Adds the test to the list of test to run55 CppUnit::TextUi::TestRunner runner;56 runner.addTest( suite );57 58 // Change the default outputter to a compiler error format outputter59 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 15 15 #include "linearsystemofequationsunittest.hpp" 16 16 #include "vector.hpp" 17 18 #ifdef HAVE_TESTRUNNER 19 #include "UnitTestMain.hpp" 20 #endif /*HAVE_TESTRUNNER*/ 17 21 18 22 /********************************************** Test classes **************************************/ … … 103 107 delete[](array); 104 108 }; 105 106 /********************************************** Main routine **************************************/107 108 int main(int argc, char **argv)109 {110 // Get the top level suite from the registry111 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();112 113 // Adds the test to the list of test to run114 CppUnit::TextUi::TestRunner runner;115 runner.addTest( suite );116 117 // Change the default outputter to a compiler error format outputter118 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 22 22 #include "molecule.hpp" 23 23 #include "periodentafel.hpp" 24 #include "World.hpp" 25 26 #ifdef HAVE_TESTRUNNER 27 #include "UnitTestMain.hpp" 28 #endif /*HAVE_TESTRUNNER*/ 24 29 25 30 /********************************************** Test classes **************************************/ … … 78 83 // remove 79 84 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 81 87 World::destroy(); 88 MemoryUsageObserver::purgeInstance(); 89 logger::purgeInstance(); 82 90 }; 83 91 … … 250 258 CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last ); 251 259 }; 252 253 /********************************************** Main routine **************************************/254 255 int main(int argc, char **argv)256 {257 // Get the top level suite from the registry258 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();259 260 // Adds the test to the list of test to run261 CppUnit::TextUi::TestRunner runner;262 runner.addTest( suite );263 264 // Change the default outputter to a compiler error format outputter265 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 15 15 #include "verbose.hpp" 16 16 17 #ifdef HAVE_TESTRUNNER 18 #include "UnitTestMain.hpp" 19 #endif /*HAVE_TESTRUNNER*/ 20 17 21 /********************************************** Test classes **************************************/ 18 22 … … 27 31 void LogTest::tearDown() 28 32 { 33 logger::purgeInstance(); 34 errorLogger::purgeInstance(); 29 35 }; 30 36 … … 48 54 eLog() << Verbose(4) << "This should not be printed." << endl; 49 55 }; 50 51 52 /********************************************** Main routine **************************************/53 54 int main(int argc, char **argv)55 {56 // Get the top level suite from the registry57 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();58 59 // Adds the test to the list of test to run60 CppUnit::TextUi::TestRunner runner;61 runner.addTest( suite );62 63 // Change the default outputter to a compiler error format outputter64 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 78 78 79 79 // some helper functions 80 bool hasAll(std::vector<atom*> atoms,int min, int max, std::set<int> excluded = std::set<int>()){80 static bool hasAll(std::vector<atom*> atoms,int min, int max, std::set<int> excluded = std::set<int>()){ 81 81 for(int i=min;i<max;++i){ 82 82 if(!excluded.count(i)){ … … 95 95 } 96 96 97 bool hasNoDuplicates(std::vector<atom*> atoms){97 static bool hasNoDuplicates(std::vector<atom*> atoms){ 98 98 std::set<int> found; 99 99 std::vector<atom*>::iterator iter; … … 107 107 } 108 108 109 void operation(atom* _atom){109 static void operation(atom* _atom){ 110 110 AtomStub *atom = dynamic_cast<AtomStub*>(_atom); 111 111 assert(atom); … … 153 153 delete obs; 154 154 } 155 156 /********************************************** Main routine **************************************/157 158 int main(int argc, char **argv)159 {160 // Get the top level suite from the registry161 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();162 163 // Adds the test to the list of test to run164 CppUnit::TextUi::TestRunner runner;165 runner.addTest( suite );166 167 // Change the default outputter to a compiler error format outputter168 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 13 13 #include "memoryallocatorunittest.hpp" 14 14 #include "helpers.hpp" 15 #include "log.hpp" 15 16 #include "defs.hpp" 17 18 #ifdef HAVE_TESTRUNNER 19 #include "UnitTestMain.hpp" 20 #endif /*HAVE_TESTRUNNER*/ 16 21 17 22 /********************************************** Test classes **************************************/ … … 29 34 { 30 35 MemoryUsageObserver::getInstance()->purgeInstance(); 36 logger::purgeInstance(); 31 37 }; 32 38 … … 102 108 Free(buffer2); 103 109 }; 104 105 106 /********************************************** Main routine **************************************/107 108 int main(int argc, char **argv)109 {110 // Get the top level suite from the registry111 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();112 113 // Adds the test to the list of test to run114 CppUnit::TextUi::TestRunner runner;115 runner.addTest( suite );116 117 // Change the default outputter to a compiler error format outputter118 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 14 14 #include "memoryusageobserverunittest.hpp" 15 15 16 #ifdef HAVE_TESTRUNNER 17 #include "UnitTestMain.hpp" 18 #endif /*HAVE_TESTRUNNER*/ 19 16 20 /********************************************** Test classes **************************************/ 17 21 // Registers the fixture into the 'registry' … … 27 31 { 28 32 MemoryUsageObserver::purgeInstance(); 33 logger::purgeInstance(); 34 errorLogger::purgeInstance(); 29 35 }; 30 36 … … 70 76 MemoryUsageObserver::getInstance()->removeMemory(i); 71 77 CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize()); 78 Free(i); 72 79 }; 73 80 … … 80 87 MemoryUsageObserver::getInstance()->removeMemory(i); 81 88 CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize()); 89 Free(i); 82 90 }; 83 91 … … 92 100 MemoryUsageObserver::getInstance()->addMemory(j, sizeof(int)); 93 101 CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize()); 102 Free(i); 103 Free(j); 94 104 }; 95 105 … … 103 113 MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int)); 104 114 CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize()); 115 Free(i); 105 116 }; 106 117 … … 114 125 MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int)); 115 126 CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory()); 127 Free(i); 116 128 }; 117 129 … … 125 137 MemoryUsageObserver::getInstance()->removeMemory(i); 126 138 CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory()); 139 Free(i); 127 140 }; 128 141 … … 135 148 MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int)); 136 149 CPPUNIT_ASSERT_EQUAL(i, (int*) MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory().begin()->first); 150 Free(i); 137 151 }; 138 139 140 /********************************************** Main routine **************************************/141 142 int main(int argc, char **argv)143 {144 // Get the top level suite from the registry145 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();146 147 // Adds the test to the list of test to run148 CppUnit::TextUi::TestRunner runner;149 runner.addTest( suite );150 151 // Change the default outputter to a compiler error format outputter152 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 14 14 #include "stackclassunittest.hpp" 15 15 #include "log.hpp" 16 17 #ifdef HAVE_TESTRUNNER 18 #include "UnitTestMain.hpp" 19 #endif /*HAVE_TESTRUNNER*/ 16 20 17 21 enum { testdimension=3 }; … … 33 37 Stack->ClearStack(); 34 38 delete(Stack); 39 MemoryUsageObserver::purgeInstance(); 40 logger::purgeInstance(); 35 41 }; 36 42 … … 67 73 CPPUNIT_ASSERT_EQUAL(0, Stack->ItemCount()); 68 74 }; 69 70 71 /********************************************** Main routine **************************************/72 73 int main(int argc, char **argv)74 {75 // Get the top level suite from the registry76 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();77 78 // Adds the test to the list of test to run79 CppUnit::TextUi::TestRunner runner;80 runner.addTest( suite );81 82 // Change the default outputter to a compiler error format outputter83 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 18 18 #include "tesselation_boundarytriangleunittest.hpp" 19 19 20 #ifdef HAVE_TESTRUNNER 21 #include "UnitTestMain.hpp" 22 #endif /*HAVE_TESTRUNNER*/ 23 20 24 #define SPHERERADIUS 2. 21 25 … … 31 35 32 36 // 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] ); 52 55 53 56 // create line … … 65 68 { 66 69 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 } 67 75 MemoryUsageObserver::purgeInstance(); 68 76 logger::purgeInstance(); … … 191 199 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 192 200 }; 193 194 195 /********************************************** Main routine **************************************/196 197 int main(int argc, char **argv)198 {199 // Get the top level suite from the registry200 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();201 202 // Adds the test to the list of test to run203 CppUnit::TextUi::TestRunner runner;204 runner.addTest( suite );205 206 // Change the default outputter to a compiler error format outputter207 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 35 35 class BoundaryLineSet *lines[3]; 36 36 class BoundaryPointSet *points[3]; 37 class TesselPoint *tesselpoints[3]; 37 38 LinkedNodes Corners; 38 39 }; -
src/unittests/tesselation_insideoutsideunittest.cpp
r1f2217 ra1510d 17 17 #include "tesselation.hpp" 18 18 #include "tesselation_insideoutsideunittest.hpp" 19 20 #ifdef HAVE_TESTRUNNER 21 #include "UnitTestMain.hpp" 22 #endif /*HAVE_TESTRUNNER*/ 19 23 20 24 #define SPHERERADIUS 2. … … 161 165 } 162 166 }; 163 164 /********************************************** Main routine **************************************/165 166 int main(int argc, char **argv)167 {168 // Get the top level suite from the registry169 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();170 171 // Adds the test to the list of test to run172 CppUnit::TextUi::TestRunner runner;173 runner.addTest( suite );174 175 // Change the default outputter to a compiler error format outputter176 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 18 18 #include "tesselation.hpp" 19 19 #include "tesselationunittest.hpp" 20 21 #ifdef HAVE_TESTRUNNER 22 #include "UnitTestMain.hpp" 23 #endif /*HAVE_TESTRUNNER*/ 20 24 21 25 #define SPHERERADIUS 2. … … 177 181 } 178 182 } 179 180 /********************************************** Main routine **************************************/181 182 int main(int argc, char **argv)183 {184 // Get the top level suite from the registry185 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();186 187 // Adds the test to the list of test to run188 CppUnit::TextUi::TestRunner runner;189 runner.addTest( suite );190 191 // Change the default outputter to a compiler error format outputter192 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 14 14 15 15 #include "defs.hpp" 16 #include "log.hpp" 17 #include "memoryusageobserver.hpp" 16 18 #include "vector.hpp" 17 19 #include "vectorunittest.hpp" 20 21 #ifdef HAVE_TESTRUNNER 22 #include "UnitTestMain.hpp" 23 #endif /*HAVE_TESTRUNNER*/ 18 24 19 25 /********************************************** Test classes **************************************/ … … 35 41 void VectorTest::tearDown() 36 42 { 43 MemoryUsageObserver::purgeInstance(); 44 logger::purgeInstance(); 45 errorLogger::purgeInstance(); 37 46 }; 38 47 … … 290 299 } 291 300 292 293 /********************************************** Main routine **************************************/294 295 int main(int argc, char **argv)296 {297 // Get the top level suite from the registry298 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();299 300 // Adds the test to the list of test to run301 CppUnit::TextUi::TestRunner runner;302 runner.addTest( suite );303 304 // Change the default outputter to a compiler error format outputter305 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.