Ignore:
Timestamp:
Apr 15, 2010, 10:54:26 AM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
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, Candidate_v1.7.0, 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:
753f02
Parents:
273382
Message:

Changed implementation of Vector to forward operations to contained objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/vectorunittest.cpp

    r273382 r1bd79e  
    2626#endif /*HAVE_TESTRUNNER*/
    2727
     28#include <iostream>
     29
     30using namespace std;
     31
    2832/********************************************** Test classes **************************************/
    2933
     
    3438void VectorTest::setUp()
    3539{
    36   zero.Init(0.,0.,0.);
    37   unit.Init(1.,0.,0.);
    38   otherunit.Init(0.,1.,0.);
    39   notunit.Init(0.,1.,1.);
    40   two.Init(2.,1.,0.);
     40  zero  = Vector(0.,0.,0.);
     41  unit = Vector(1.,0.,0.);
     42  otherunit = Vector(0.,1.,0.);
     43  notunit = Vector(0.,1.,1.);
     44  two = Vector(2.,1.,0.);
    4145};
    4246
     
    6973  double factor;
    7074  // copy vector
    71   fixture.Init(2.,3.,4.);
     75  fixture = Vector(2.,3.,4.);
    7276  CPPUNIT_ASSERT_EQUAL( Vector(2.,3.,4.), fixture );
    7377  // summation and scaling
     
    223227void VectorTest::VectorRotationTest()
    224228{
    225   fixture.Init(-1.,0.,0.);
     229  fixture = Vector(-1.,0.,0.);
    226230
    227231  // zero vector does not change
     
    266270  parallelepiped[8] = 1;
    267271
    268   fixture.CopyVector(zero);
    269   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    270   fixture.Init(2.5,2.5,2.5);
     272  fixture = zero;
     273  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     274  fixture = Vector(2.5,2.5,2.5);
    271275  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    272   fixture.Init(1.,1.,1.);
    273   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    274   fixture.Init(3.5,3.5,3.5);
    275   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    276   fixture.Init(2.,2.,2.);
     276  fixture = Vector(1.,1.,1.);
     277  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     278  fixture = Vector(3.5,3.5,3.5);
     279  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     280  fixture = Vector(2.,2.,2.);
    277281  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    278   fixture.Init(2.,3.,2.);
     282  fixture = Vector(2.,3.,2.);
    279283  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    280   fixture.Init(-2.,2.,-1.);
    281   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    282 }
    283 
     284  fixture = Vector(-2.,2.,-1.);
     285  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     286}
     287
Note: See TracChangeset for help on using the changeset viewer.