Changeset 6d750f for src/unittests


Ignore:
Timestamp:
Jul 15, 2010, 11:30:52 AM (14 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:
f3526d
Parents:
4506cc
Message:

More unittests for Shapes added

Location:
src/unittests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/ShapeUnittest.cpp

    r4506cc r6d750f  
    170170  CPPUNIT_ASSERT(!Sphere().isInside(v122));
    171171  CPPUNIT_ASSERT(!Sphere().isInside(v222));
     172}
     173
     174void ShapeUnittest::surfaceTest(){
     175  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v000));
     176  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v100));
     177  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v200));
     178  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v010));
     179  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v110));
     180  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v210));
     181  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v020));
     182  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v120));
     183  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v220));
     184  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v001));
     185  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v101));
     186  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v201));
     187  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v011));
     188  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v111));
     189  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v211));
     190  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v021));
     191  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v121));
     192  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v221));
     193  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v002));
     194  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v102));
     195  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v202));
     196  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v012));
     197  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v112));
     198  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v212));
     199  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v022));
     200  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v122));
     201  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v222));
     202
     203  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v000));
     204  CPPUNIT_ASSERT(Cuboid().isOnSurface(v100));
     205  CPPUNIT_ASSERT(Cuboid().isOnSurface(v200));
     206  CPPUNIT_ASSERT(Cuboid().isOnSurface(v010));
     207  CPPUNIT_ASSERT(Cuboid().isOnSurface(v110));
     208  CPPUNIT_ASSERT(Cuboid().isOnSurface(v210));
     209  CPPUNIT_ASSERT(Cuboid().isOnSurface(v020));
     210  CPPUNIT_ASSERT(Cuboid().isOnSurface(v120));
     211  CPPUNIT_ASSERT(Cuboid().isOnSurface(v220));
     212  CPPUNIT_ASSERT(Cuboid().isOnSurface(v001));
     213  CPPUNIT_ASSERT(Cuboid().isOnSurface(v101));
     214  CPPUNIT_ASSERT(Cuboid().isOnSurface(v201));
     215  CPPUNIT_ASSERT(Cuboid().isOnSurface(v011));
     216  CPPUNIT_ASSERT(Cuboid().isOnSurface(v111));
     217  CPPUNIT_ASSERT(Cuboid().isOnSurface(v211));
     218  CPPUNIT_ASSERT(Cuboid().isOnSurface(v021));
     219  CPPUNIT_ASSERT(Cuboid().isOnSurface(v121));
     220  CPPUNIT_ASSERT(Cuboid().isOnSurface(v221));
     221  CPPUNIT_ASSERT(Cuboid().isOnSurface(v002));
     222  CPPUNIT_ASSERT(Cuboid().isOnSurface(v102));
     223  CPPUNIT_ASSERT(Cuboid().isOnSurface(v202));
     224  CPPUNIT_ASSERT(Cuboid().isOnSurface(v012));
     225  CPPUNIT_ASSERT(Cuboid().isOnSurface(v112));
     226  CPPUNIT_ASSERT(Cuboid().isOnSurface(v212));
     227  CPPUNIT_ASSERT(Cuboid().isOnSurface(v022));
     228  CPPUNIT_ASSERT(Cuboid().isOnSurface(v122));
     229  CPPUNIT_ASSERT(Cuboid().isOnSurface(v222));
     230
     231  CPPUNIT_ASSERT(!Sphere().isOnSurface(v000));
     232  CPPUNIT_ASSERT(Sphere().isOnSurface(v100));
     233  CPPUNIT_ASSERT(Sphere().isOnSurface(v200));
     234  CPPUNIT_ASSERT(Sphere().isOnSurface(v010));
     235  CPPUNIT_ASSERT(!Sphere().isOnSurface(v110));
     236  CPPUNIT_ASSERT(!Sphere().isOnSurface(v210));
     237  CPPUNIT_ASSERT(Sphere().isOnSurface(v020));
     238  CPPUNIT_ASSERT(!Sphere().isOnSurface(v120));
     239  CPPUNIT_ASSERT(!Sphere().isOnSurface(v220));
     240  CPPUNIT_ASSERT(Sphere().isOnSurface(v001));
     241  CPPUNIT_ASSERT(!Sphere().isOnSurface(v101));
     242  CPPUNIT_ASSERT(!Sphere().isOnSurface(v201));
     243  CPPUNIT_ASSERT(!Sphere().isOnSurface(v011));
     244  CPPUNIT_ASSERT(!Sphere().isOnSurface(v111));
     245  CPPUNIT_ASSERT(!Sphere().isOnSurface(v211));
     246  CPPUNIT_ASSERT(!Sphere().isOnSurface(v021));
     247  CPPUNIT_ASSERT(!Sphere().isOnSurface(v121));
     248  CPPUNIT_ASSERT(!Sphere().isOnSurface(v221));
     249  CPPUNIT_ASSERT(Sphere().isOnSurface(v002));
     250  CPPUNIT_ASSERT(!Sphere().isOnSurface(v102));
     251  CPPUNIT_ASSERT(!Sphere().isOnSurface(v202));
     252  CPPUNIT_ASSERT(!Sphere().isOnSurface(v012));
     253  CPPUNIT_ASSERT(!Sphere().isOnSurface(v112));
     254  CPPUNIT_ASSERT(!Sphere().isOnSurface(v212));
     255  CPPUNIT_ASSERT(!Sphere().isOnSurface(v022));
     256  CPPUNIT_ASSERT(!Sphere().isOnSurface(v122));
     257  CPPUNIT_ASSERT(!Sphere().isOnSurface(v222));
    172258}
    173259
     
    417503  }
    418504
     505  {
     506    Shape s1 = Sphere() && Cuboid(); // should be the same as Sphere
     507
     508    CPPUNIT_ASSERT(s1.isInside(v000));
     509    CPPUNIT_ASSERT(s1.isInside(v100));
     510    CPPUNIT_ASSERT(s1.isInside(v200));
     511    CPPUNIT_ASSERT(s1.isInside(v010));
     512    CPPUNIT_ASSERT(!s1.isInside(v110));
     513    CPPUNIT_ASSERT(!s1.isInside(v210));
     514    CPPUNIT_ASSERT(s1.isInside(v020));
     515    CPPUNIT_ASSERT(!s1.isInside(v120));
     516    CPPUNIT_ASSERT(!s1.isInside(v220));
     517    CPPUNIT_ASSERT(s1.isInside(v001));
     518    CPPUNIT_ASSERT(!s1.isInside(v101));
     519    CPPUNIT_ASSERT(!s1.isInside(v201));
     520    CPPUNIT_ASSERT(!s1.isInside(v011));
     521    CPPUNIT_ASSERT(!s1.isInside(v111));
     522    CPPUNIT_ASSERT(!s1.isInside(v211));
     523    CPPUNIT_ASSERT(!s1.isInside(v021));
     524    CPPUNIT_ASSERT(!s1.isInside(v121));
     525    CPPUNIT_ASSERT(!s1.isInside(v221));
     526    CPPUNIT_ASSERT(s1.isInside(v002));
     527    CPPUNIT_ASSERT(!s1.isInside(v102));
     528    CPPUNIT_ASSERT(!s1.isInside(v202));
     529    CPPUNIT_ASSERT(!s1.isInside(v012));
     530    CPPUNIT_ASSERT(!s1.isInside(v112));
     531    CPPUNIT_ASSERT(!s1.isInside(v212));
     532    CPPUNIT_ASSERT(!s1.isInside(v022));
     533    CPPUNIT_ASSERT(!s1.isInside(v122));
     534    CPPUNIT_ASSERT(!s1.isInside(v222));
     535
     536    CPPUNIT_ASSERT(!s1.isOnSurface(v000));
     537    CPPUNIT_ASSERT(s1.isOnSurface(v100));
     538    CPPUNIT_ASSERT(s1.isOnSurface(v200));
     539    CPPUNIT_ASSERT(s1.isOnSurface(v010));
     540    CPPUNIT_ASSERT(!s1.isOnSurface(v110));
     541    CPPUNIT_ASSERT(!s1.isOnSurface(v210));
     542    CPPUNIT_ASSERT(s1.isOnSurface(v020));
     543    CPPUNIT_ASSERT(!s1.isOnSurface(v120));
     544    CPPUNIT_ASSERT(!s1.isOnSurface(v220));
     545    CPPUNIT_ASSERT(s1.isOnSurface(v001));
     546    CPPUNIT_ASSERT(!s1.isOnSurface(v101));
     547    CPPUNIT_ASSERT(!s1.isOnSurface(v201));
     548    CPPUNIT_ASSERT(!s1.isOnSurface(v011));
     549    CPPUNIT_ASSERT(!s1.isOnSurface(v111));
     550    CPPUNIT_ASSERT(!s1.isOnSurface(v211));
     551    CPPUNIT_ASSERT(!s1.isOnSurface(v021));
     552    CPPUNIT_ASSERT(!s1.isOnSurface(v121));
     553    CPPUNIT_ASSERT(!s1.isOnSurface(v221));
     554    CPPUNIT_ASSERT(s1.isOnSurface(v002));
     555    CPPUNIT_ASSERT(!s1.isOnSurface(v102));
     556    CPPUNIT_ASSERT(!s1.isOnSurface(v202));
     557    CPPUNIT_ASSERT(!s1.isOnSurface(v012));
     558    CPPUNIT_ASSERT(!s1.isOnSurface(v112));
     559    CPPUNIT_ASSERT(!s1.isOnSurface(v212));
     560    CPPUNIT_ASSERT(!s1.isOnSurface(v022));
     561    CPPUNIT_ASSERT(!s1.isOnSurface(v122));
     562    CPPUNIT_ASSERT(!s1.isOnSurface(v222));
     563
     564
     565    Shape s2 = Sphere() || Cuboid(); // Should be same as Cuboid
     566
     567    CPPUNIT_ASSERT(s2.isInside(v000));
     568    CPPUNIT_ASSERT(s2.isInside(v100));
     569    CPPUNIT_ASSERT(s2.isInside(v200));
     570    CPPUNIT_ASSERT(s2.isInside(v010));
     571    CPPUNIT_ASSERT(s2.isInside(v110));
     572    CPPUNIT_ASSERT(s2.isInside(v210));
     573    CPPUNIT_ASSERT(s2.isInside(v020));
     574    CPPUNIT_ASSERT(s2.isInside(v120));
     575    CPPUNIT_ASSERT(s2.isInside(v220));
     576    CPPUNIT_ASSERT(s2.isInside(v001));
     577    CPPUNIT_ASSERT(s2.isInside(v101));
     578    CPPUNIT_ASSERT(s2.isInside(v201));
     579    CPPUNIT_ASSERT(s2.isInside(v011));
     580    CPPUNIT_ASSERT(s2.isInside(v111));
     581    CPPUNIT_ASSERT(s2.isInside(v211));
     582    CPPUNIT_ASSERT(s2.isInside(v021));
     583    CPPUNIT_ASSERT(s2.isInside(v121));
     584    CPPUNIT_ASSERT(s2.isInside(v221));
     585    CPPUNIT_ASSERT(s2.isInside(v002));
     586    CPPUNIT_ASSERT(s2.isInside(v102));
     587    CPPUNIT_ASSERT(s2.isInside(v202));
     588    CPPUNIT_ASSERT(s2.isInside(v012));
     589    CPPUNIT_ASSERT(s2.isInside(v112));
     590    CPPUNIT_ASSERT(s2.isInside(v212));
     591    CPPUNIT_ASSERT(s2.isInside(v022));
     592    CPPUNIT_ASSERT(s2.isInside(v122));
     593    CPPUNIT_ASSERT(s2.isInside(v222));
     594
     595    CPPUNIT_ASSERT(!s2.isOnSurface(v000));
     596    CPPUNIT_ASSERT(s2.isOnSurface(v100));
     597    CPPUNIT_ASSERT(s2.isOnSurface(v200));
     598    CPPUNIT_ASSERT(s2.isOnSurface(v010));
     599    CPPUNIT_ASSERT(s2.isOnSurface(v110));
     600    CPPUNIT_ASSERT(s2.isOnSurface(v210));
     601    CPPUNIT_ASSERT(s2.isOnSurface(v020));
     602    CPPUNIT_ASSERT(s2.isOnSurface(v120));
     603    CPPUNIT_ASSERT(s2.isOnSurface(v220));
     604    CPPUNIT_ASSERT(s2.isOnSurface(v001));
     605    CPPUNIT_ASSERT(s2.isOnSurface(v101));
     606    CPPUNIT_ASSERT(s2.isOnSurface(v201));
     607    CPPUNIT_ASSERT(s2.isOnSurface(v011));
     608    CPPUNIT_ASSERT(s2.isOnSurface(v111));
     609    CPPUNIT_ASSERT(s2.isOnSurface(v211));
     610    CPPUNIT_ASSERT(s2.isOnSurface(v021));
     611    CPPUNIT_ASSERT(s2.isOnSurface(v121));
     612    CPPUNIT_ASSERT(s2.isOnSurface(v221));
     613    CPPUNIT_ASSERT(s2.isOnSurface(v002));
     614    CPPUNIT_ASSERT(s2.isOnSurface(v102));
     615    CPPUNIT_ASSERT(s2.isOnSurface(v202));
     616    CPPUNIT_ASSERT(s2.isOnSurface(v012));
     617    CPPUNIT_ASSERT(s2.isOnSurface(v112));
     618    CPPUNIT_ASSERT(s2.isOnSurface(v212));
     619    CPPUNIT_ASSERT(s2.isOnSurface(v022));
     620    CPPUNIT_ASSERT(s2.isOnSurface(v122));
     621    CPPUNIT_ASSERT(s2.isOnSurface(v222));
     622  }
     623
    419624}
  • src/unittests/ShapeUnittest.hpp

    r4506cc r6d750f  
    2020  CPPUNIT_TEST_SUITE( ShapeUnittest) ;
    2121  CPPUNIT_TEST ( baseShapesTest );
     22  CPPUNIT_TEST ( surfaceTest );
    2223  CPPUNIT_TEST ( assignmentTest );
    2324  CPPUNIT_TEST ( operatorTest );
     
    2930
    3031  void baseShapesTest();
     32  void surfaceTest();
    3133  void assignmentTest();
    3234  void operatorTest();
Note: See TracChangeset for help on using the changeset viewer.