Changeset 0fad93 for src/Graph/unittests
- Timestamp:
- Dec 3, 2012, 9:50:01 AM (12 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:
- 5197e5
- Parents:
- 91207d
- git-author:
- Frederik Heber <heber@…> (09/20/12 16:31:44)
- git-committer:
- Frederik Heber <heber@…> (12/03/12 09:50:01)
- Location:
- src/Graph/unittests
- Files:
-
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Graph/unittests/AdjacencyListUnitTest.cpp
r91207d r0fad93 22 22 23 23 /* 24 * CheckAgainstAdjacencyFileUnitTest.cpp24 * AdjacencyListUnitTest.cpp 25 25 * 26 26 * Created on: Oct 17, 2011 … … 33 33 #endif 34 34 35 #include " CheckAgainstAdjacencyFileUnitTest.hpp"35 #include "AdjacencyListUnitTest.hpp" 36 36 37 37 #include <cppunit/CompilerOutputter.h> … … 52 52 #include "Element/element.hpp" 53 53 #include "Element/periodentafel.hpp" 54 #include "Graph/ CheckAgainstAdjacencyFile.hpp"54 #include "Graph/AdjacencyList.hpp" 55 55 #include "molecule.hpp" 56 56 #include "World.hpp" … … 63 63 /********************************************** Test classes **************************************/ 64 64 // Registers the fixture into the 'registry' 65 CPPUNIT_TEST_SUITE_REGISTRATION( CheckAgainstAdjacencyFileTest );65 CPPUNIT_TEST_SUITE_REGISTRATION( AdjacencyListTest ); 66 66 67 67 static std::string adjacencyfile ="\ … … 115 115 116 116 // set up and tear down 117 void CheckAgainstAdjacencyFileTest::setUp()117 void AdjacencyListTest::setUp() 118 118 { 119 119 // failing asserts should be thrown … … 148 148 } 149 149 150 void CheckAgainstAdjacencyFileTest::tearDown()150 void AdjacencyListTest::tearDown() 151 151 { 152 152 comparisonMap.clear(); … … 161 161 } 162 162 163 /** Unit tests for CheckAgainstAdjacencyFile::CreateExternalMap().164 * 165 */ 166 void CheckAgainstAdjacencyFileTest::CreateExternalMapTest()163 /** Unit tests for AdjacencyList::CreateExternalMap(). 164 * 165 */ 166 void AdjacencyListTest::CreateExternalMapTest() 167 167 { 168 168 std::stringstream input; 169 CheckAgainstAdjacencyFilefileChecker(input);169 AdjacencyList fileChecker(input); 170 170 fileChecker.CreateExternalMap(atomIds); 171 171 … … 190 190 } 191 191 192 /** Unit tests for CheckAgainstAdjacencyFile::ParseInInternalMap().193 * 194 */ 195 void CheckAgainstAdjacencyFileTest::ParseInInternalMapTest()192 /** Unit tests for AdjacencyList::ParseInInternalMap(). 193 * 194 */ 195 void AdjacencyListTest::ParseInInternalMapTest() 196 196 { 197 197 std::stringstream input(adjacencyfile); 198 CheckAgainstAdjacencyFilefileChecker(input);198 AdjacencyList fileChecker(input); 199 199 std::vector<atomId_t> noids; 200 200 fileChecker.CreateExternalMap(noids); … … 218 218 } 219 219 220 /** Unit tests for CheckAgainstAdjacencyFile::CompareInternalExternalMap().221 * 222 */ 223 void CheckAgainstAdjacencyFileTest::CompareInternalExternalMapTest()220 /** Unit tests for AdjacencyList::CompareInternalExternalMap(). 221 * 222 */ 223 void AdjacencyListTest::CompareInternalExternalMapTest() 224 224 { 225 225 std::stringstream input(adjacencyfile); 226 CheckAgainstAdjacencyFilefileChecker(input);226 AdjacencyList fileChecker(input); 227 227 228 228 // assert equality before parsing (empty sets should always return true) … … 240 240 } 241 241 242 /** Unit tests for CheckAgainstAdjacencyFile::operator()().243 * 244 */ 245 void CheckAgainstAdjacencyFileTest::operatorTest()242 /** Unit tests for AdjacencyList::operator()(). 243 * 244 */ 245 void AdjacencyListTest::CheckAgainstSubsetTest() 246 246 { 247 247 { 248 248 // parse right 249 249 std::stringstream input(adjacencyfile); 250 CheckAgainstAdjacencyFilefileChecker(input);251 CPPUNIT_ASSERT( fileChecker (atomIds) );250 AdjacencyList fileChecker(input); 251 CPPUNIT_ASSERT( fileChecker.CheckAgainstSubset(atomIds) ); 252 252 } 253 253 { 254 254 // parse wrong1 (more atoms in the world than in file, hence wrong) 255 255 std::stringstream input(wrongadjacencyfile1); 256 CheckAgainstAdjacencyFilefileChecker(input);257 CPPUNIT_ASSERT( !fileChecker (atomIds) );256 AdjacencyList fileChecker(input); 257 CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) ); 258 258 } 259 259 { … … 264 264 // parse wrong1 (more atoms in the world than in file, hence wrong) 265 265 std::stringstream input(wrongadjacencyfile1); 266 CheckAgainstAdjacencyFilefileChecker(input);267 CPPUNIT_ASSERT( fileChecker (validids) );266 AdjacencyList fileChecker(input); 267 CPPUNIT_ASSERT( fileChecker.CheckAgainstSubset(validids) ); 268 268 } 269 269 { 270 270 // parse wrong2 (there is no atom 10, but present in file. hence true) 271 271 std::stringstream input(wrongadjacencyfile2); 272 CheckAgainstAdjacencyFilefileChecker(input);273 CPPUNIT_ASSERT( !fileChecker (atomIds) );272 AdjacencyList fileChecker(input); 273 CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) ); 274 274 } 275 275 { 276 276 // parse wrong3 (6 is not connected) 277 277 std::stringstream input(wrongadjacencyfile3); 278 CheckAgainstAdjacencyFilefileChecker(input);279 CPPUNIT_ASSERT( !fileChecker (atomIds) );280 } 281 } 278 AdjacencyList fileChecker(input); 279 CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) ); 280 } 281 } -
src/Graph/unittests/AdjacencyListUnitTest.hpp
r91207d r0fad93 1 1 /* 2 * CheckAgainstAdjacencyFileUnitTest.hpp2 * AdjacencyListUnitTest.hpp 3 3 * 4 4 * Created on: Oct 17, 2011 … … 6 6 */ 7 7 8 #ifndef CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_9 #define CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_8 #ifndef UNITTEST_HPP_ 9 #define UNITTEST_HPP_ 10 10 11 11 // include config.h … … 17 17 #include <cppunit/extensions/HelperMacros.h> 18 18 19 #include "Graph/ CheckAgainstAdjacencyFile.hpp"19 #include "Graph/AdjacencyList.hpp" 20 20 #include "types.hpp" 21 21 … … 27 27 class World; 28 28 29 class CheckAgainstAdjacencyFileTest : public CppUnit::TestFixture29 class AdjacencyListTest : public CppUnit::TestFixture 30 30 { 31 CPPUNIT_TEST_SUITE( CheckAgainstAdjacencyFileTest );31 CPPUNIT_TEST_SUITE( AdjacencyListTest ); 32 32 CPPUNIT_TEST ( CreateExternalMapTest ); 33 33 CPPUNIT_TEST ( ParseInInternalMapTest ); 34 34 CPPUNIT_TEST ( CompareInternalExternalMapTest ); 35 CPPUNIT_TEST ( operatorTest );35 CPPUNIT_TEST ( CheckAgainstSubsetTest ); 36 36 CPPUNIT_TEST_SUITE_END(); 37 37 … … 43 43 void ParseInInternalMapTest(); 44 44 void CompareInternalExternalMapTest(); 45 void operatorTest();45 void CheckAgainstSubsetTest(); 46 46 47 47 private: 48 CheckAgainstAdjacencyFile::AtomBondMap comparisonMap;48 AdjacencyList::AtomBondMap comparisonMap; 49 49 std::vector<atom *> atoms; 50 50 std::vector<atomId_t> atomIds; … … 52 52 }; 53 53 54 #endif /* CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_ */54 #endif /* UNITTEST_HPP_ */ -
src/Graph/unittests/Makefile.am
r91207d r0fad93 3 3 4 4 GRAPHTESTSSOURCES = \ 5 ../Graph/unittests/ BondGraphUnitTest.cpp \6 ../Graph/unittests/ CheckAgainstAdjacencyFileUnitTest.cpp5 ../Graph/unittests/AdjacencyListUnitTest.cpp \ 6 ../Graph/unittests/BondGraphUnitTest.cpp 7 7 8 8 GRAPHTESTSHEADERS = \ 9 ../Graph/unittests/ BondGraphUnitTest.hpp \10 ../Graph/unittests/ CheckAgainstAdjacencyFileUnitTest.hpp9 ../Graph/unittests/AdjacencyListUnitTest.hpp \ 10 ../Graph/unittests/BondGraphUnitTest.hpp 11 11 12 12 GRAPHTESTS = \ 13 BondGraphUnitTest \14 CheckAgainstAdjacencyFileUnitTest13 AdjacencyListUnitTest \ 14 BondGraphUnitTest 15 15 16 16 … … 32 32 33 33 34 AdjacencyListUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 35 ../Graph/unittests/AdjacencyListUnitTest.cpp \ 36 ../Graph/unittests/AdjacencyListUnitTest.hpp 37 AdjacencyListUnitTest_LDADD = ${ALLLIBS} 38 34 39 BondGraphUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 35 40 ../Graph/unittests/BondGraphUnitTest.cpp \ … … 37 42 BondGraphUnitTest_LDADD = ${GRAPHLIBS} 38 43 39 CheckAgainstAdjacencyFileUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \40 ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp \41 ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp42 CheckAgainstAdjacencyFileUnitTest_LDADD = ${ALLLIBS}43 44 44 45 45
Note:
See TracChangeset
for help on using the changeset viewer.