Changeset 4e855e for src/unittests
- Timestamp:
- Feb 4, 2011, 6:56:38 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:
- febef3
- Parents:
- fd3788
- git-author:
- Frederik Heber <heber@…> (02/04/11 18:54:12)
- git-committer:
- Frederik Heber <heber@…> (02/04/11 18:56:38)
- Location:
- src/unittests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/AnalysisBondsUnitTest.cpp
rfd3788 r4e855e 92 92 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 5 ); 93 93 94 // create a small file with table 95 filename = new string("test.dat"); 96 CPPUNIT_ASSERT(filename != NULL && "could not create string"); 97 ofstream test(filename->c_str()); 94 // create stream with table 95 std::stringstream test; 98 96 test << ".\tH\tHe\tLi\tBe\tB\tC\n"; 99 97 test << "H\t1.\t1.\t1.\t1.\t1.\t1.2\n"; … … 103 101 test << "B\t1.\t1.\t1.\t1.\t1.\t1.\n"; 104 102 test << "C\t1.2\t1.\t1.\t1.\t1.\t1.5\n"; 105 test.close();106 103 BG = new BondGraph(true); 107 104 CPPUNIT_ASSERT(BG != NULL && "could not create BondGraph"); 108 105 109 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable( *filename) );106 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(test) ); 110 107 CPPUNIT_ASSERT_EQUAL( 1., BG->GetBondLength(0,0) ); 111 108 CPPUNIT_ASSERT_EQUAL( 1.2, BG->GetBondLength(0,5) ); … … 119 116 { 120 117 // remove the file 121 remove(filename->c_str());122 delete(filename);123 118 delete(BG); 124 119 -
src/unittests/BondGraphUnitTest.cpp
rfd3788 r4e855e 92 92 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 93 93 94 // create a small file with table 95 dummyname = new string("dummy.dat"); 96 CPPUNIT_ASSERT(dummyname != NULL && "could not create string"); 97 filename = new string("test.dat"); 98 CPPUNIT_ASSERT(filename != NULL && "could not create string"); 99 ofstream test(filename->c_str()); 94 // create stream with table 100 95 test << ".\tH\tHe\tLi\tBe\tB\tC\n"; 101 96 test << "H\t1.\t1.\t1.\t1.\t1.\t1.2\n"; … … 105 100 test << "B\t1.\t1.\t1.\t1.\t1.\t1.\n"; 106 101 test << "C\t1.2\t1.\t1.\t1.\t1.\t1.5\n"; 107 test.close(); 102 // created bad stream (i.e. non-present file) 103 dummy.setstate(ios::eofbit); 104 CPPUNIT_ASSERT(dummy.eof()); 108 105 BG = new BondGraph(true); 109 106 CPPUNIT_ASSERT(BG != NULL && "could not create BondGraph"); … … 114 111 { 115 112 // remove the file 116 remove(filename->c_str());117 delete(filename);118 delete(dummyname);119 113 delete(BG); 120 114 … … 139 133 void BondGraphTest::LoadTableTest() 140 134 { 141 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable( *filename) );135 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(test) ); 142 136 CPPUNIT_ASSERT_EQUAL( 1., BG->GetBondLength(0,0) ); 143 137 CPPUNIT_ASSERT_EQUAL( 1.2, BG->GetBondLength(0,5) ); … … 152 146 molecule::iterator Runner = TestMolecule->begin(); 153 147 Runner++; 154 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable( *filename) );148 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(test) ); 155 149 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 156 150 CPPUNIT_ASSERT_EQUAL( true , (*Walker)->IsBondedTo((*Runner)) ); … … 165 159 //atom *Runner = TestMolecule->end->previous; 166 160 //CPPUNIT_ASSERT( TestMolecule->end != Walker ); 167 CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable( *dummyname) );161 CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(dummy) ); 168 162 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 169 163 -
src/unittests/BondGraphUnitTest.hpp
rfd3788 r4e855e 49 49 50 50 BondGraph *BG; 51 st ring *filename;52 st ring *dummyname;51 std::stringstream dummy; 52 std::stringstream test; 53 53 }; 54 54
Note:
See TracChangeset
for help on using the changeset viewer.