Changeset 7e37a3


Ignore:
Timestamp:
Aug 10, 2010, 12:40:42 PM (14 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:
7aa3cf
Parents:
92c52f
Message:

Added undo/redo test to Standard_configuration/6 (FastParsingAction).

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/CmdAction/FastParsingAction.cpp

    r92c52f r7e37a3  
    2828class CommandLineFastParsingState : public ActionState {
    2929public:
    30   CommandLineFastParsingState(bool _bool) :
    31     boolean(_bool)
     30  CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) :
     31    oldvalue(_oldvalue),
     32    newvalue(_newvalue)
    3233  {}
    33   bool boolean;
     34  bool oldvalue;
     35  bool newvalue;
    3436};
    3537
     
    5860
    5961Action::state_ptr CommandLineFastParsingAction::performCall() {
    60 
    6162  config *configuration = World::getInstance().getConfig();
    62   ValueStorage::getInstance().queryCurrentValue(NAME, configuration->FastParsing);
     63  bool oldvalue = configuration->FastParsing;
     64  bool newvalue;
     65  ValueStorage::getInstance().queryCurrentValue(NAME, newvalue);
     66  configuration->FastParsing = newvalue;
    6367  if (configuration->FastParsing)
    6468    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    6569  else
    6670    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    67   return Action::success;
     71  return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue));
    6872}
    6973
     
    7276
    7377  config *configuration = World::getInstance().getConfig();
    74   configuration->FastParsing = state->boolean;
     78  configuration->FastParsing = state->oldvalue;
     79  if (configuration->FastParsing)
     80    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
     81  else
     82    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    7583
    76   return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
     84  return Action::state_ptr(_state);
    7785}
    7886
    7987Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){
    80   return performUndo(_state);
     88  CommandLineFastParsingState *state = assert_cast<CommandLineFastParsingState*>(_state.get());
     89
     90  config *configuration = World::getInstance().getConfig();
     91  configuration->FastParsing = state->newvalue;
     92  if (configuration->FastParsing)
     93    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
     94  else
     95    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
     96
     97  return Action::state_ptr(_state);
    8198}
    8299
  • tests/regression/testsuite-standard_options.at

    r92c52f r7e37a3  
    6060AT_CHECK([fgrep "I won't parse trajectories" stdout], 0, [ignore], [ignore])
    6161AT_CLEANUP
     62AT_SETUP([Standard Options - fast trajectories with Undo/Redo])
     63AT_KEYWORDS([options])
     64AT_CHECK([../../molecuilder -i test.conf -n 1 --undo], 0, [stdout], [stderr])
     65AT_CHECK([fgrep "I will parse trajectories." stdout], 0, [ignore], [ignore])
     66AT_CHECK([../../molecuilder -i test.conf -n 1 --undo --redo], 0, [stdout], [stderr])
     67AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, 2
     68, [ignore])
     69AT_CLEANUP
    6270
    6371# 7. molecule default name
     
    6775AT_CHECK([fgrep "Default name of new molecules set to test." stdout], 0, [ignore], [ignore])
    6876AT_CLEANUP
     77#AT_SETUP([Standard Options - molecule default name with Undo/Redo])
     78#AT_KEYWORDS([options])
     79#AT_CHECK([../../molecuilder -i test.conf -X test2 -X test --undo], 0, [stdout], [stderr])
     80#AT_CHECK([fgrep "Default name of new molecules set to test2." stdout], 0, [ignore], [ignore])
     81#AT_CHECK([../../molecuilder -i test.conf -X test2 -X test --undo --redo], 0, [stdout], [stderr])
     82#AT_CHECK([fgrep "Default name of new molecules set to test." stdout], 0, [ignore], [ignore])
     83#AT_CLEANUP
Note: See TracChangeset for help on using the changeset viewer.