Changeset 0fad93 for src/Graph/unittests/AdjacencyListUnitTest.cpp
- Timestamp:
- Dec 3, 2012, 9:50:01 AM (13 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, Candidate_v1.7.0, 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)
- File:
-
- 1 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 }
Note:
See TracChangeset
for help on using the changeset viewer.
