Ignore:
Timestamp:
Jul 12, 2017, 7:10:32 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Action_Thermostats, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
966ce7
Parents:
0dc8bf2
git-author:
Frederik Heber <frederik.heber@…> (05/19/17 09:27:11)
git-committer:
Frederik Heber <frederik.heber@…> (07/12/17 19:10:32)
Message:

Extended BreadthFirstSearchGatherer to allow BFS with limited discovery horizon.

  • TESTS: extended unit test as well.
File:
1 edited

Legend:

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

    r0dc8bf2 re3ec8a8  
    105105  CPPUNIT_ASSERT_EQUAL (compareids, atomids);
    106106};
     107
     108/** Tests whether operator() with limited distance works.
     109 */
     110void BreadthFirstSearchGathererTest::limitedDistanceTest()
     111{
     112  // create linear test graph
     113  prepareLinearGraph();
     114
     115  // call operator
     116  BreadthFirstSearchGatherer gatherer(*BGCreator);
     117  {
     118    std::vector<atomId_t> atomids = gatherer(0, 3);
     119
     120    // create comparator set
     121    std::vector<atomId_t> compareids;
     122    compareids += 1,2,3,4;
     123    CPPUNIT_ASSERT_EQUAL ((size_t)4, atomids.size());
     124    CPPUNIT_ASSERT_EQUAL (compareids, atomids);
     125  }
     126  // zero distance means just find the initial node
     127  {
     128    std::vector<atomId_t> atomids = gatherer(0, 0);
     129
     130    // create comparator set
     131    std::vector<atomId_t> compareids;
     132    compareids += 1;
     133    CPPUNIT_ASSERT_EQUAL ((size_t)1, atomids.size());
     134    CPPUNIT_ASSERT_EQUAL (compareids, atomids);
     135  }
     136  // negative distance means find all
     137  {
     138    std::vector<atomId_t> atomids = gatherer(0, -1);
     139
     140    // create comparator set
     141    std::vector<atomId_t> compareids;
     142    compareids += 1,2,3,4,5;
     143    CPPUNIT_ASSERT_EQUAL ((size_t)5, atomids.size());
     144    CPPUNIT_ASSERT_EQUAL (compareids, atomids);
     145  }
     146};
Note: See TracChangeset for help on using the changeset viewer.