Changeset 8d38e6 for src/Fragmentation


Ignore:
Timestamp:
Sep 12, 2016, 2:03:15 PM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
f9d85f
Parents:
946948
git-author:
Frederik Heber <heber@…> (06/04/14 11:23:31)
git-committer:
Frederik Heber <heber@…> (09/12/16 14:03:15)
Message:

Added more unit test functions up to N=8 to SphericalPointDistributionUnitTest.

  • marked unit test as XFAIL.
Location:
src/Fragmentation/Exporters/unittests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Exporters/unittests/Makefile.am

    r946948 r8d38e6  
    2121
    2222TESTS += $(FRAGMENTATIONEXPORTERSTESTS)
     23XFAIL_TESTS += SphericalPointDistributionUnitTest
    2324check_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS)
    2425noinst_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS)
  • src/Fragmentation/Exporters/unittests/SphericalPointDistributionUnitTest.cpp

    r946948 r8d38e6  
    4848
    4949#include "CodePatterns/Assert.hpp"
     50#include "CodePatterns/Log.hpp"
    5051
    5152#include "Fragmentation/Exporters/SphericalPointDistribution.hpp"
     
    6768  // failing asserts should be thrown
    6869  ASSERT_DO(Assert::Throw);
     70
     71  setVerbosity(5);
    6972}
    7073
     
    101104        SPD.get<2>();
    102105    SphericalPointDistribution::Polygon_t expected;
    103     expected += Vector(-1.,0.,0.);
     106    expected += Vector(0.,-1.,0.);
     107    SphericalPointDistribution::Polygon_t remaining =
     108        SphericalPointDistribution::matchSphericalPointDistributions(
     109            polygon,
     110            newpolygon);
     111    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     112  }
     113
     114  // test with one point, just a flip to another axis
     115  {
     116    SphericalPointDistribution::Polygon_t polygon;
     117    polygon += Vector(0.,0.,-1.);
     118    SphericalPointDistribution::Polygon_t newpolygon =
     119        SPD.get<2>();
     120    SphericalPointDistribution::Polygon_t expected;
     121    expected += Vector(0.,0.,1.);
    104122    SphericalPointDistribution::Polygon_t remaining =
    105123        SphericalPointDistribution::matchSphericalPointDistributions(
     
    130148    CPPUNIT_ASSERT_EQUAL( expected, remaining );
    131149  }
    132 }
     150
     151  // test with one point, just a flip of axis
     152  {
     153    SphericalPointDistribution::Polygon_t polygon;
     154    polygon += Vector(0.,1.,0.);
     155    SphericalPointDistribution::Polygon_t newpolygon =
     156        SPD.get<3>();
     157    SphericalPointDistribution::Polygon_t expected = newpolygon;
     158    expected.pop_front(); // remove first point
     159    SphericalPointDistribution::Polygon_t remaining =
     160        SphericalPointDistribution::matchSphericalPointDistributions(
     161            polygon,
     162            newpolygon);
     163    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     164  }
     165}
     166
     167/** UnitTest for matchSphericalPointDistributions() with four points
     168 */
     169void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_4()
     170{
     171  SphericalPointDistribution SPD(1.);
     172
     173  // test with one point, matching trivially
     174  {
     175    SphericalPointDistribution::Polygon_t polygon;
     176    polygon += Vector(1.,0.,0.);
     177    SphericalPointDistribution::Polygon_t newpolygon =
     178        SPD.get<4>();
     179    SphericalPointDistribution::Polygon_t expected = newpolygon;
     180    expected.pop_front(); // remove first point
     181    SphericalPointDistribution::Polygon_t remaining =
     182        SphericalPointDistribution::matchSphericalPointDistributions(
     183            polygon,
     184            newpolygon);
     185    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     186  }
     187
     188  // test with one point, just a flip of axis
     189  {
     190    SphericalPointDistribution::Polygon_t polygon;
     191    polygon += Vector(0.,1.,0.);
     192    SphericalPointDistribution::Polygon_t newpolygon =
     193        SPD.get<4>();
     194    SphericalPointDistribution::Polygon_t expected = newpolygon;
     195    expected.pop_front(); // remove first point
     196    SphericalPointDistribution::Polygon_t remaining =
     197        SphericalPointDistribution::matchSphericalPointDistributions(
     198            polygon,
     199            newpolygon);
     200    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     201  }
     202}
     203
     204/** UnitTest for matchSphericalPointDistributions() with five points
     205 */
     206void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_5()
     207{
     208  SphericalPointDistribution SPD(1.);
     209
     210  // test with one point, matching trivially
     211  {
     212    SphericalPointDistribution::Polygon_t polygon;
     213    polygon += Vector(1.,0.,0.);
     214    SphericalPointDistribution::Polygon_t newpolygon =
     215        SPD.get<5>();
     216    SphericalPointDistribution::Polygon_t expected = newpolygon;
     217    expected.pop_front(); // remove first point
     218    SphericalPointDistribution::Polygon_t remaining =
     219        SphericalPointDistribution::matchSphericalPointDistributions(
     220            polygon,
     221            newpolygon);
     222    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     223  }
     224
     225  // test with one point, just a flip of axis
     226  {
     227    SphericalPointDistribution::Polygon_t polygon;
     228    polygon += Vector(0.,1.,0.);
     229    SphericalPointDistribution::Polygon_t newpolygon =
     230        SPD.get<5>();
     231    SphericalPointDistribution::Polygon_t expected = newpolygon;
     232    expected.pop_front(); // remove first point
     233    SphericalPointDistribution::Polygon_t remaining =
     234        SphericalPointDistribution::matchSphericalPointDistributions(
     235            polygon,
     236            newpolygon);
     237    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     238  }
     239}
     240
     241/** UnitTest for matchSphericalPointDistributions() with six points
     242 */
     243void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_6()
     244{
     245  SphericalPointDistribution SPD(1.);
     246
     247  // test with one point, matching trivially
     248  {
     249    SphericalPointDistribution::Polygon_t polygon;
     250    polygon += Vector(1.,0.,0.);
     251    SphericalPointDistribution::Polygon_t newpolygon =
     252        SPD.get<6>();
     253    SphericalPointDistribution::Polygon_t expected = newpolygon;
     254    expected.pop_front(); // remove first point
     255    SphericalPointDistribution::Polygon_t remaining =
     256        SphericalPointDistribution::matchSphericalPointDistributions(
     257            polygon,
     258            newpolygon);
     259    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     260  }
     261
     262  // test with one point, just a flip of axis
     263  {
     264    SphericalPointDistribution::Polygon_t polygon;
     265    polygon += Vector(0.,1.,0.);
     266    SphericalPointDistribution::Polygon_t newpolygon =
     267        SPD.get<6>();
     268    SphericalPointDistribution::Polygon_t expected = newpolygon;
     269    expected.pop_front(); // remove first point
     270    SphericalPointDistribution::Polygon_t remaining =
     271        SphericalPointDistribution::matchSphericalPointDistributions(
     272            polygon,
     273            newpolygon);
     274    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     275  }
     276}
     277
     278/** UnitTest for matchSphericalPointDistributions() with seven points
     279 */
     280void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_7()
     281{
     282  SphericalPointDistribution SPD(1.);
     283
     284  // test with one point, matching trivially
     285  {
     286    SphericalPointDistribution::Polygon_t polygon;
     287    polygon += Vector(1.,0.,0.);
     288    SphericalPointDistribution::Polygon_t newpolygon =
     289        SPD.get<7>();
     290    SphericalPointDistribution::Polygon_t expected = newpolygon;
     291    expected.pop_front(); // remove first point
     292    SphericalPointDistribution::Polygon_t remaining =
     293        SphericalPointDistribution::matchSphericalPointDistributions(
     294            polygon,
     295            newpolygon);
     296    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     297  }
     298
     299  // test with one point, just a flip of axis
     300  {
     301    SphericalPointDistribution::Polygon_t polygon;
     302    polygon += Vector(0.,1.,0.);
     303    SphericalPointDistribution::Polygon_t newpolygon =
     304        SPD.get<7>();
     305    SphericalPointDistribution::Polygon_t expected = newpolygon;
     306    expected.pop_front(); // remove first point
     307    SphericalPointDistribution::Polygon_t remaining =
     308        SphericalPointDistribution::matchSphericalPointDistributions(
     309            polygon,
     310            newpolygon);
     311    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     312  }
     313}
     314
     315/** UnitTest for matchSphericalPointDistributions() with eight points
     316 */
     317void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_8()
     318{
     319  SphericalPointDistribution SPD(1.);
     320
     321  // test with one point, matching trivially
     322  {
     323    SphericalPointDistribution::Polygon_t polygon;
     324    polygon += Vector(1.,0.,0.);
     325    SphericalPointDistribution::Polygon_t newpolygon =
     326        SPD.get<8>();
     327    SphericalPointDistribution::Polygon_t expected = newpolygon;
     328    expected.pop_front(); // remove first point
     329    SphericalPointDistribution::Polygon_t remaining =
     330        SphericalPointDistribution::matchSphericalPointDistributions(
     331            polygon,
     332            newpolygon);
     333    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     334  }
     335
     336  // test with one point, just a flip of axis
     337  {
     338    SphericalPointDistribution::Polygon_t polygon;
     339    polygon += Vector(0.,1.,0.);
     340    SphericalPointDistribution::Polygon_t newpolygon =
     341        SPD.get<8>();
     342    SphericalPointDistribution::Polygon_t expected = newpolygon;
     343    expected.pop_front(); // remove first point
     344    SphericalPointDistribution::Polygon_t remaining =
     345        SphericalPointDistribution::matchSphericalPointDistributions(
     346            polygon,
     347            newpolygon);
     348    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     349  }
     350}
  • src/Fragmentation/Exporters/unittests/SphericalPointDistributionUnitTest.hpp

    r946948 r8d38e6  
    2424    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_2 );
    2525    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_3 );
     26    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_4 );
     27    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_5 );
     28    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_6 );
     29    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_7 );
     30    CPPUNIT_TEST ( matchSphericalPointDistributionsTest_8 );
    2631    CPPUNIT_TEST_SUITE_END();
    2732
     
    3136      void matchSphericalPointDistributionsTest_2();
    3237      void matchSphericalPointDistributionsTest_3();
     38      void matchSphericalPointDistributionsTest_4();
     39      void matchSphericalPointDistributionsTest_5();
     40      void matchSphericalPointDistributionsTest_6();
     41      void matchSphericalPointDistributionsTest_7();
     42      void matchSphericalPointDistributionsTest_8();
    3343
    3444private:
Note: See TracChangeset for help on using the changeset viewer.