Changeset 5ec8e3 for src/unittests


Ignore:
Timestamp:
Jul 2, 2010, 9:51:01 AM (15 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, 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:
36166d
Parents:
56fb09 (diff), 7ac4af (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.
Message:

Merge branch 'VectorRefactoring' into StructureRefactoring

Conflicts:

molecuilder/src/Makefile.am

Location:
src/unittests
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/LineUnittest.cpp

    r56fb09 r5ec8e3  
    1717
    1818#include <iostream>
     19#include <cmath>
    1920
    2021using namespace std;
     
    352353  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
    353354}
     355
     356void LineUnittest::sphereIntersectionTest(){
     357  {
     358    std::vector<Vector> res = la1->getSphereIntersections();
     359    CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
     360    CPPUNIT_ASSERT(testDirection(res[0],e1));
     361    CPPUNIT_ASSERT(testDirection(res[1],e1));
     362    CPPUNIT_ASSERT(res[0]!=res[1]);
     363  }
     364
     365  {
     366    std::vector<Vector> res = la2->getSphereIntersections();
     367    CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
     368    CPPUNIT_ASSERT(testDirection(res[0],e2));
     369    CPPUNIT_ASSERT(testDirection(res[1],e2));
     370    CPPUNIT_ASSERT(res[0]!=res[1]);
     371  }
     372
     373  {
     374    std::vector<Vector> res = la3->getSphereIntersections();
     375    CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
     376    CPPUNIT_ASSERT(testDirection(res[0],e3));
     377    CPPUNIT_ASSERT(testDirection(res[1],e3));
     378    CPPUNIT_ASSERT(res[0]!=res[1]);
     379  }
     380
     381  {
     382    std::vector<Vector> res = lp1->getSphereIntersections();
     383    CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
     384    CPPUNIT_ASSERT((res[0]==e1) || (res[0]==e2));
     385    CPPUNIT_ASSERT((res[1]==e1) || (res[1]==e2));
     386    CPPUNIT_ASSERT(res[0]!=res[1]);
     387  }
     388
     389  {
     390    std::vector<Vector> res = lp2->getSphereIntersections();
     391    CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
     392    CPPUNIT_ASSERT((res[0]==e2) || (res[0]==e3));
     393    CPPUNIT_ASSERT((res[1]==e2) || (res[1]==e3));
     394    CPPUNIT_ASSERT(res[0]!=res[1]);
     395  }
     396
     397  {
     398    std::vector<Vector> res = lp3->getSphereIntersections();
     399    CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
     400    CPPUNIT_ASSERT((res[0]==e3) || (res[0]==e1));
     401    CPPUNIT_ASSERT((res[1]==e3) || (res[1]==e1));
     402    CPPUNIT_ASSERT(res[0]!=res[1]);
     403  }
     404}
  • src/unittests/LineUnittest.hpp

    r56fb09 r5ec8e3  
    2222  CPPUNIT_TEST ( intersectionTest );
    2323  CPPUNIT_TEST ( rotationTest );
     24  CPPUNIT_TEST ( sphereIntersectionTest );
    2425  CPPUNIT_TEST_SUITE_END();
    2526
     
    3334  void intersectionTest();
    3435  void rotationTest();
     36  void sphereIntersectionTest();
    3537
    3638private:
  • src/unittests/Makefile.am

    r56fb09 r5ec8e3  
    3838  periodentafelTest \
    3939  PlaneUnittest \
     40  ShapeUnittest \
    4041  SingletonTest \
    4142  StackClassUnitTest \
     
    8384  periodentafelTest.cpp \
    8485  PlaneUnittest.cpp \
     86  ShapeUnittest.cpp \
    8587  SingletonTest.cpp \
    8688  stackclassunittest.cpp \
     
    210212PlaneUnittest_LDADD = ${ALLLIBS}
    211213
     214ShapeUnittest_SOURCES = UnitTestMain.cpp ShapeUnittest.cpp ShapeUnittest.hpp
     215ShapeUnittest_LDADD = ${ALLLIBS}
     216
    212217SingletonTest_SOURCES = UnitTestMain.cpp SingletonTest.cpp SingletonTest.hpp
    213218SingletonTest_LDADD = ${ALLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
  • src/unittests/PlaneUnittest.cpp

    r56fb09 r5ec8e3  
    1111#include <cppunit/extensions/TestFactoryRegistry.h>
    1212#include <cppunit/ui/text/TestRunner.h>
     13
     14#include <cmath>
    1315
    1416#ifdef HAVE_TESTRUNNER
  • src/unittests/linearsystemofequationsunittest.cpp

    r56fb09 r5ec8e3  
    1212#include <cppunit/extensions/TestFactoryRegistry.h>
    1313#include <cppunit/ui/text/TestRunner.h>
     14#include <cmath>
    1415
    1516#include "linearsystemofequationsunittest.hpp"
  • src/unittests/vectorunittest.cpp

    r56fb09 r5ec8e3  
    2121#include "Plane.hpp"
    2222#include "Exceptions/LinearDependenceException.hpp"
     23#include "Matrix.hpp"
    2324
    2425#ifdef HAVE_TESTRUNNER
     
    214215  CPPUNIT_ASSERT(testVector.ScalarProduct(three) < MYEPSILON);
    215216}
    216 
    217 
    218 /**
    219  * UnitTest for Vector::IsInParallelepiped().
    220  */
    221 void VectorTest::IsInParallelepipedTest()
    222 {
    223   double parallelepiped[NDIM*NDIM];
    224   parallelepiped[0] = 1;
    225   parallelepiped[1] = 0;
    226   parallelepiped[2] = 0;
    227   parallelepiped[3] = 0;
    228   parallelepiped[4] = 1;
    229   parallelepiped[5] = 0;
    230   parallelepiped[6] = 0;
    231   parallelepiped[7] = 0;
    232   parallelepiped[8] = 1;
    233 
    234   fixture = zero;
    235   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    236   fixture = Vector(2.5,2.5,2.5);
    237   CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    238   fixture = Vector(1.,1.,1.);
    239   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    240   fixture = Vector(3.5,3.5,3.5);
    241   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    242   fixture = Vector(2.,2.,2.);
    243   CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    244   fixture = Vector(2.,3.,2.);
    245   CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    246   fixture = Vector(-2.,2.,-1.);
    247   CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
    248 }
    249 
  • src/unittests/vectorunittest.hpp

    r56fb09 r5ec8e3  
    2727    CPPUNIT_TEST ( ProjectionTest );
    2828    CPPUNIT_TEST ( NormalsTest );
    29     CPPUNIT_TEST ( IsInParallelepipedTest );
    3029    CPPUNIT_TEST_SUITE_END();
    3130
     
    4544    void LineIntersectionTest();
    4645    void VectorRotationTest();
    47     void IsInParallelepipedTest();
    4846
    4947private:
Note: See TracChangeset for help on using the changeset viewer.