Changeset 0fad93 for src/Graph/unittests


Ignore:
Timestamp:
Dec 3, 2012, 9:50:01 AM (12 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
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)
Message:

Renamed CheckAgainstAdjacencyFile -> AdjacencyList.

Location:
src/Graph/unittests
Files:
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • src/Graph/unittests/AdjacencyListUnitTest.cpp

    r91207d r0fad93  
    2222
    2323/*
    24  * CheckAgainstAdjacencyFileUnitTest.cpp
     24 * AdjacencyListUnitTest.cpp
    2525 *
    2626 *  Created on: Oct 17, 2011
     
    3333#endif
    3434
    35 #include "CheckAgainstAdjacencyFileUnitTest.hpp"
     35#include "AdjacencyListUnitTest.hpp"
    3636
    3737#include <cppunit/CompilerOutputter.h>
     
    5252#include "Element/element.hpp"
    5353#include "Element/periodentafel.hpp"
    54 #include "Graph/CheckAgainstAdjacencyFile.hpp"
     54#include "Graph/AdjacencyList.hpp"
    5555#include "molecule.hpp"
    5656#include "World.hpp"
     
    6363/********************************************** Test classes **************************************/
    6464// Registers the fixture into the 'registry'
    65 CPPUNIT_TEST_SUITE_REGISTRATION( CheckAgainstAdjacencyFileTest );
     65CPPUNIT_TEST_SUITE_REGISTRATION( AdjacencyListTest );
    6666
    6767static std::string adjacencyfile ="\
     
    115115
    116116// set up and tear down
    117 void CheckAgainstAdjacencyFileTest::setUp()
     117void AdjacencyListTest::setUp()
    118118{
    119119  // failing asserts should be thrown
     
    148148}
    149149
    150 void CheckAgainstAdjacencyFileTest::tearDown()
     150void AdjacencyListTest::tearDown()
    151151{
    152152  comparisonMap.clear();
     
    161161}
    162162
    163 /** Unit tests for CheckAgainstAdjacencyFile::CreateExternalMap().
    164  *
    165  */
    166 void CheckAgainstAdjacencyFileTest::CreateExternalMapTest()
     163/** Unit tests for AdjacencyList::CreateExternalMap().
     164 *
     165 */
     166void AdjacencyListTest::CreateExternalMapTest()
    167167{
    168168  std::stringstream input;
    169   CheckAgainstAdjacencyFile fileChecker(input);
     169  AdjacencyList fileChecker(input);
    170170  fileChecker.CreateExternalMap(atomIds);
    171171
     
    190190}
    191191
    192 /** Unit tests for CheckAgainstAdjacencyFile::ParseInInternalMap().
    193  *
    194  */
    195 void CheckAgainstAdjacencyFileTest::ParseInInternalMapTest()
     192/** Unit tests for AdjacencyList::ParseInInternalMap().
     193 *
     194 */
     195void AdjacencyListTest::ParseInInternalMapTest()
    196196{
    197197  std::stringstream input(adjacencyfile);
    198   CheckAgainstAdjacencyFile fileChecker(input);
     198  AdjacencyList fileChecker(input);
    199199  std::vector<atomId_t> noids;
    200200  fileChecker.CreateExternalMap(noids);
     
    218218}
    219219
    220 /** Unit tests for CheckAgainstAdjacencyFile::CompareInternalExternalMap().
    221  *
    222  */
    223 void CheckAgainstAdjacencyFileTest::CompareInternalExternalMapTest()
     220/** Unit tests for AdjacencyList::CompareInternalExternalMap().
     221 *
     222 */
     223void AdjacencyListTest::CompareInternalExternalMapTest()
    224224{
    225225  std::stringstream input(adjacencyfile);
    226   CheckAgainstAdjacencyFile fileChecker(input);
     226  AdjacencyList fileChecker(input);
    227227
    228228  // assert equality before parsing (empty sets should always return true)
     
    240240}
    241241
    242 /** Unit tests for CheckAgainstAdjacencyFile::operator()().
    243  *
    244  */
    245 void CheckAgainstAdjacencyFileTest::operatorTest()
     242/** Unit tests for AdjacencyList::operator()().
     243 *
     244 */
     245void AdjacencyListTest::CheckAgainstSubsetTest()
    246246{
    247247  {
    248248    // parse right
    249249    std::stringstream input(adjacencyfile);
    250     CheckAgainstAdjacencyFile fileChecker(input);
    251     CPPUNIT_ASSERT( fileChecker(atomIds) );
     250    AdjacencyList fileChecker(input);
     251    CPPUNIT_ASSERT( fileChecker.CheckAgainstSubset(atomIds) );
    252252  }
    253253  {
    254254    // parse wrong1 (more atoms in the world than in file, hence wrong)
    255255    std::stringstream input(wrongadjacencyfile1);
    256     CheckAgainstAdjacencyFile fileChecker(input);
    257     CPPUNIT_ASSERT( !fileChecker(atomIds) );
     256    AdjacencyList fileChecker(input);
     257    CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) );
    258258  }
    259259  {
     
    264264    // parse wrong1 (more atoms in the world than in file, hence wrong)
    265265    std::stringstream input(wrongadjacencyfile1);
    266     CheckAgainstAdjacencyFile fileChecker(input);
    267     CPPUNIT_ASSERT( fileChecker(validids) );
     266    AdjacencyList fileChecker(input);
     267    CPPUNIT_ASSERT( fileChecker.CheckAgainstSubset(validids) );
    268268  }
    269269  {
    270270    // parse wrong2 (there is no atom 10, but present in file. hence true)
    271271    std::stringstream input(wrongadjacencyfile2);
    272     CheckAgainstAdjacencyFile fileChecker(input);
    273     CPPUNIT_ASSERT( !fileChecker(atomIds) );
     272    AdjacencyList fileChecker(input);
     273    CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) );
    274274  }
    275275  {
    276276    // parse wrong3 (6 is not connected)
    277277    std::stringstream input(wrongadjacencyfile3);
    278     CheckAgainstAdjacencyFile fileChecker(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  
    11/*
    2  * CheckAgainstAdjacencyFileUnitTest.hpp
     2 * AdjacencyListUnitTest.hpp
    33 *
    44 *  Created on: Oct 17, 2011
     
    66 */
    77
    8 #ifndef CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_
    9 #define CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_
     8#ifndef UNITTEST_HPP_
     9#define UNITTEST_HPP_
    1010
    1111// include config.h
     
    1717#include <cppunit/extensions/HelperMacros.h>
    1818
    19 #include "Graph/CheckAgainstAdjacencyFile.hpp"
     19#include "Graph/AdjacencyList.hpp"
    2020#include "types.hpp"
    2121
     
    2727class World;
    2828
    29 class CheckAgainstAdjacencyFileTest : public CppUnit::TestFixture
     29class AdjacencyListTest : public CppUnit::TestFixture
    3030{
    31   CPPUNIT_TEST_SUITE( CheckAgainstAdjacencyFileTest );
     31  CPPUNIT_TEST_SUITE( AdjacencyListTest );
    3232  CPPUNIT_TEST ( CreateExternalMapTest );
    3333  CPPUNIT_TEST ( ParseInInternalMapTest );
    3434  CPPUNIT_TEST ( CompareInternalExternalMapTest );
    35   CPPUNIT_TEST ( operatorTest );
     35  CPPUNIT_TEST ( CheckAgainstSubsetTest );
    3636  CPPUNIT_TEST_SUITE_END();
    3737
     
    4343  void ParseInInternalMapTest();
    4444  void CompareInternalExternalMapTest();
    45   void operatorTest();
     45  void CheckAgainstSubsetTest();
    4646
    4747private:
    48   CheckAgainstAdjacencyFile::AtomBondMap comparisonMap;
     48  AdjacencyList::AtomBondMap comparisonMap;
    4949  std::vector<atom *> atoms;
    5050  std::vector<atomId_t> atomIds;
     
    5252};
    5353
    54 #endif /* CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_ */
     54#endif /* UNITTEST_HPP_ */
  • src/Graph/unittests/Makefile.am

    r91207d r0fad93  
    33
    44GRAPHTESTSSOURCES = \
    5         ../Graph/unittests/BondGraphUnitTest.cpp \
    6         ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp
     5        ../Graph/unittests/AdjacencyListUnitTest.cpp \
     6        ../Graph/unittests/BondGraphUnitTest.cpp
    77
    88GRAPHTESTSHEADERS = \
    9         ../Graph/unittests/BondGraphUnitTest.hpp \
    10         ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp
     9        ../Graph/unittests/AdjacencyListUnitTest.hpp \
     10        ../Graph/unittests/BondGraphUnitTest.hpp
    1111
    1212GRAPHTESTS = \
    13         BondGraphUnitTest \
    14         CheckAgainstAdjacencyFileUnitTest
     13        AdjacencyListUnitTest \
     14        BondGraphUnitTest
    1515
    1616
     
    3232
    3333
     34AdjacencyListUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     35        ../Graph/unittests/AdjacencyListUnitTest.cpp \
     36        ../Graph/unittests/AdjacencyListUnitTest.hpp
     37AdjacencyListUnitTest_LDADD = ${ALLLIBS}
     38
    3439BondGraphUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    3540        ../Graph/unittests/BondGraphUnitTest.cpp \
     
    3742BondGraphUnitTest_LDADD = ${GRAPHLIBS}
    3843
    39 CheckAgainstAdjacencyFileUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    40         ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp \
    41         ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp
    42 CheckAgainstAdjacencyFileUnitTest_LDADD = ${ALLLIBS}
    43 
    4444
    4545
Note: See TracChangeset for help on using the changeset viewer.