Changeset 360c8b for src/Parser/unittests/ParserTremoloUnitTest.cpp
- Timestamp:
- Oct 20, 2011, 10:42:16 PM (14 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:
- f94953
- Parents:
- fa9d1d (diff), 752bb4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (10/20/11 22:40:59)
- git-committer:
- Frederik Heber <heber@…> (10/20/11 22:42:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Parser/unittests/ParserTremoloUnitTest.cpp ¶
rfa9d1d r360c8b 27 27 #include "Descriptors/AtomTypeDescriptor.hpp" 28 28 #include "Element/element.hpp" 29 #include "Parser/MpqcParser.hpp" 30 #include "Parser/PdbParser.hpp" 31 #include "Parser/PcpParser.hpp" 29 #include "Element/periodentafel.hpp" 32 30 #include "Parser/TremoloParser.hpp" 33 #include "Parser/XyzParser.hpp" 34 #include "Element/periodentafel.hpp" 31 #include "Parser/ChangeTracker.hpp" 35 32 #include "World.hpp" 36 33 #include "WorldTime.hpp" … … 85 82 World::getInstance(); 86 83 84 parser = new FormatParser<tremolo>(); 85 87 86 // we need hydrogens and oxygens in the following tests 88 87 CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(1) != NULL); … … 90 89 } 91 90 92 void ParserTremoloUnitTest::tearDown() { 91 void ParserTremoloUnitTest::tearDown() 92 { 93 delete parser; 93 94 ChangeTracker::purgeInstance(); 94 95 World::purgeInstance(); … … 99 100 void ParserTremoloUnitTest::readTremoloPreliminaryCommentsTest() { 100 101 cout << "Testing the tremolo parser." << endl; 101 TremoloParser* testParser = new TremoloParser();102 102 stringstream input, output; 103 103 … … 105 105 { 106 106 input << Tremolo_Atomdata1; 107 testParser->load(&input);108 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 109 testParser->save(&output, atoms);107 parser->load(&input); 108 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 109 parser->save(&output, atoms); 110 110 // std::cout << output.str() << std::endl; 111 111 // std::cout << Tremolo_Atomdata1 << std::endl; … … 118 118 { 119 119 input << Tremolo_Atomdata2; 120 testParser->load(&input);121 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 122 testParser->save(&output, atoms);120 parser->load(&input); 121 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 122 parser->save(&output, atoms); 123 123 std::cout << output.str() << std::endl; 124 124 CPPUNIT_ASSERT(output.str().find("hydrogen") != string::npos); … … 129 129 // Invalid key in Atomdata line 130 130 input << Tremolo_invalidkey; 131 testParser->load(&input);131 parser->load(&input); 132 132 //TODO: prove invalidity 133 133 input.clear(); … … 135 135 136 136 void ParserTremoloUnitTest::readTremoloCoordinatesTest() { 137 TremoloParser* testParser = new TremoloParser();138 137 stringstream input; 139 138 140 139 // One simple data line 141 140 input << Tremolo_Atomdata2; 142 testParser->load(&input);141 parser->load(&input); 143 142 CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->at(0) == 3.0); 144 143 input.clear(); … … 146 145 147 146 void ParserTremoloUnitTest::readTremoloVelocityTest() { 148 TremoloParser* testParser = new TremoloParser();149 147 stringstream input; 150 148 151 149 // One simple data line 152 150 input << Tremolo_velocity; 153 testParser->load(&input);151 parser->load(&input); 154 152 CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->getAtomicVelocity()[0] == 3.0); 155 153 input.clear(); … … 157 155 158 156 void ParserTremoloUnitTest::readTremoloNeighborInformationTest() { 159 TremoloParser* testParser = new TremoloParser();160 157 stringstream input; 161 158 162 159 // Neighbor data 163 160 input << Tremolo_neighbours; 164 testParser->load(&input);161 parser->load(&input); 165 162 166 163 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); … … 171 168 172 169 void ParserTremoloUnitTest::readAndWriteTremoloImprDataInformationTest() { 173 TremoloParser* testParser = new TremoloParser();174 170 stringstream input, output; 175 171 … … 177 173 { 178 174 input << Tremolo_improper; 179 testParser->load(&input);180 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 181 testParser->save(&output, atoms);175 parser->load(&input); 176 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 177 parser->save(&output, atoms); 182 178 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); 183 179 std::cout << output.str() << std::endl; … … 189 185 190 186 void ParserTremoloUnitTest::readAndWriteTremoloTorsionInformationTest() { 191 TremoloParser* testParser = new TremoloParser();192 187 stringstream input, output; 193 188 … … 195 190 { 196 191 input << Tremolo_torsion; 197 testParser->load(&input);198 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 199 testParser->save(&output, atoms);192 parser->load(&input); 193 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 194 parser->save(&output, atoms); 200 195 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); 201 196 std::cout << output.str() << std::endl; … … 207 202 208 203 void ParserTremoloUnitTest::writeTremoloTest() { 209 TremoloParser* testParser = new TremoloParser();210 204 stringstream output; 211 205 … … 214 208 atom* newAtom = World::getInstance().createAtom(); 215 209 newAtom->setType(1); 216 testParser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");217 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 218 testParser->save(&output, atoms);210 parser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion"); 211 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 212 parser->save(&output, atoms); 219 213 CPPUNIT_ASSERT(output.str() == Tremolo_full); 220 214 } … … 222 216 cout << "testing the tremolo parser is done" << endl; 223 217 } 218
Note:
See TracChangeset
for help on using the changeset viewer.