Changeset 1bd79e for src/unittests
- Timestamp:
- Apr 15, 2010, 10:54:26 AM (15 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:
- 753f02
- Parents:
- 273382
- Location:
- src/unittests
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/ActOnAllUnitTest.cpp
r273382 r1bd79e 70 70 71 71 // scaling by value 72 VL.ActOnAll( (void (Vector::*)(const double)) &Vector::Scale, 2.);72 VL.ActOnAll( (void (Vector::*)(const double)) &Vector::Scale, factor ); 73 73 CPPUNIT_ASSERT_EQUAL( VL == Ref , false ); 74 74 75 VL.ActOnAll( (void (Vector::*)(const double)) &Vector::Scale, 0.5 ); 76 CPPUNIT_ASSERT_EQUAL( VL == Ref , true ); 77 78 // scaling by ref 79 VL.ActOnAll( (void (Vector::*)(const double * const)) &Vector::Scale, (const double * const)&factor ); 80 CPPUNIT_ASSERT_EQUAL( VL == Ref , false ); 81 82 VL.ActOnAll( (void (Vector::*)(const double * const)) &Vector::Scale, (const double * const)&inverse ); 75 VL.ActOnAll( (void (Vector::*)(const double)) &Vector::Scale, inverse ); 83 76 CPPUNIT_ASSERT_EQUAL( VL == Ref , true ); 84 77 … … 90 83 inverses[i] = 1./factors[i]; 91 84 } 92 VL.ActOnAll ( (void (Vector::*)(const double ** const)) &Vector::Scale, (const double ** const)&factors );85 VL.ActOnAll<Vector,void,const double*>(&Vector::ScaleAll, factors ); 93 86 CPPUNIT_ASSERT_EQUAL( VL == Ref , false ); 94 87 95 VL.ActOnAll ( (void (Vector::*)(const double ** const)) &Vector::Scale, (const double ** const)&inverses );88 VL.ActOnAll<Vector,void,const double*>(&Vector::ScaleAll, inverses ); 96 89 CPPUNIT_ASSERT_EQUAL( VL == Ref , true ); 97 90 Free(factors); -
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
r273382 r1bd79e 64 64 Walker = World::getInstance().createAtom(); 65 65 Walker->type = hydrogen; 66 Walker->node->Init(1., 0., 1. );66 *Walker->node = Vector(1., 0., 1. ); 67 67 TestMolecule->AddAtom(Walker); 68 68 Walker = World::getInstance().createAtom(); 69 69 Walker->type = hydrogen; 70 Walker->node->Init(0., 1., 1. );70 *Walker->node = Vector(0., 1., 1. ); 71 71 TestMolecule->AddAtom(Walker); 72 72 Walker = World::getInstance().createAtom(); 73 73 Walker->type = hydrogen; 74 Walker->node->Init(1., 1., 0. );74 *Walker->node = Vector(1., 1., 0. ); 75 75 TestMolecule->AddAtom(Walker); 76 76 Walker = World::getInstance().createAtom(); 77 77 Walker->type = hydrogen; 78 Walker->node->Init(0., 0., 0. );78 *Walker->node = Vector(0., 0., 0. ); 79 79 TestMolecule->AddAtom(Walker); 80 80 -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
r273382 r1bd79e 40 40 void AnalysisCorrelationToSurfaceUnitTest::setUp() 41 41 { 42 ASSERT_DO(Assert::Throw);42 //ASSERT_DO(Assert::Throw); 43 43 44 44 atom *Walker = NULL; … … 73 73 Walker = World::getInstance().createAtom(); 74 74 Walker->type = hydrogen; 75 Walker->node->Init(1., 0., 1. );76 TestMolecule->AddAtom(Walker); 77 Walker = World::getInstance().createAtom(); 78 Walker->type = hydrogen; 79 Walker->node->Init(0., 1., 1. );80 TestMolecule->AddAtom(Walker); 81 Walker = World::getInstance().createAtom(); 82 Walker->type = hydrogen; 83 Walker->node->Init(1., 1., 0. );84 TestMolecule->AddAtom(Walker); 85 Walker = World::getInstance().createAtom(); 86 Walker->type = hydrogen; 87 Walker->node->Init(0., 0., 0. );75 *Walker->node = Vector(1., 0., 1. ); 76 TestMolecule->AddAtom(Walker); 77 Walker = World::getInstance().createAtom(); 78 Walker->type = hydrogen; 79 *Walker->node = Vector(0., 1., 1. ); 80 TestMolecule->AddAtom(Walker); 81 Walker = World::getInstance().createAtom(); 82 Walker->type = hydrogen; 83 *Walker->node = Vector(1., 1., 0. ); 84 TestMolecule->AddAtom(Walker); 85 Walker = World::getInstance().createAtom(); 86 Walker->type = hydrogen; 87 *Walker->node = Vector(0., 0., 0. ); 88 88 TestMolecule->AddAtom(Walker); 89 89 … … 106 106 Walker = World::getInstance().createAtom(); 107 107 Walker->type = carbon; 108 Walker->node->Init(4., 0., 4. );109 TestMolecule->AddAtom(Walker); 110 Walker = World::getInstance().createAtom(); 111 Walker->type = carbon; 112 Walker->node->Init(0., 4., 4. );113 TestMolecule->AddAtom(Walker); 114 Walker = World::getInstance().createAtom(); 115 Walker->type = carbon; 116 Walker->node->Init(4., 4., 0. );108 *Walker->node = Vector(4., 0., 4. ); 109 TestMolecule->AddAtom(Walker); 110 Walker = World::getInstance().createAtom(); 111 Walker->type = carbon; 112 *Walker->node = Vector(0., 4., 4. ); 113 TestMolecule->AddAtom(Walker); 114 Walker = World::getInstance().createAtom(); 115 Walker->type = carbon; 116 *Walker->node = Vector(4., 4., 0. ); 117 117 TestMolecule->AddAtom(Walker); 118 118 // add inner atoms 119 119 Walker = World::getInstance().createAtom(); 120 120 Walker->type = carbon; 121 Walker->node->Init(0.5, 0.5, 0.5 );121 *Walker->node = Vector(0.5, 0.5, 0.5 ); 122 122 TestMolecule->AddAtom(Walker); 123 123 -
src/unittests/AnalysisPairCorrelationUnitTest.cpp
r273382 r1bd79e 63 63 Walker = World::getInstance().createAtom(); 64 64 Walker->type = hydrogen; 65 Walker->node->Init(1., 0., 1. );65 *Walker->node = Vector(1., 0., 1. ); 66 66 TestMolecule->AddAtom(Walker); 67 67 Walker = World::getInstance().createAtom(); 68 68 Walker->type = hydrogen; 69 Walker->node->Init(0., 1., 1. );69 *Walker->node = Vector(0., 1., 1. ); 70 70 TestMolecule->AddAtom(Walker); 71 71 Walker = World::getInstance().createAtom(); 72 72 Walker->type = hydrogen; 73 Walker->node->Init(1., 1., 0. );73 *Walker->node = Vector(1., 1., 0. ); 74 74 TestMolecule->AddAtom(Walker); 75 75 Walker = World::getInstance().createAtom(); 76 76 Walker->type = hydrogen; 77 Walker->node->Init(0., 0., 0. );77 *Walker->node = Vector(0., 0., 0. ); 78 78 TestMolecule->AddAtom(Walker); 79 79 -
src/unittests/analysisbondsunittest.cpp
r273382 r1bd79e 69 69 Walker = World::getInstance().createAtom(); 70 70 Walker->type = hydrogen; 71 Walker->node->Init(1.5, 0., 1.5 );71 *Walker->node = Vector(1.5, 0., 1.5 ); 72 72 TestMolecule->AddAtom(Walker); 73 73 Walker = World::getInstance().createAtom(); 74 74 Walker->type = hydrogen; 75 Walker->node->Init(0., 1.5, 1.5 );75 *Walker->node = Vector(0., 1.5, 1.5 ); 76 76 TestMolecule->AddAtom(Walker); 77 77 Walker = World::getInstance().createAtom(); 78 78 Walker->type = hydrogen; 79 Walker->node->Init(1.5, 1.5, 0. );79 *Walker->node = Vector(1.5, 1.5, 0. ); 80 80 TestMolecule->AddAtom(Walker); 81 81 Walker = World::getInstance().createAtom(); 82 82 Walker->type = hydrogen; 83 Walker->node->Init(0., 0., 0. );83 *Walker->node = Vector(0., 0., 0. ); 84 84 TestMolecule->AddAtom(Walker); 85 85 Walker = World::getInstance().createAtom(); 86 86 Walker->type = carbon; 87 Walker->node->Init(0.5, 0.5, 0.5 );87 *Walker->node = Vector(0.5, 0.5, 0.5 ); 88 88 TestMolecule->AddAtom(Walker); 89 89 -
src/unittests/bondgraphunittest.cpp
r273382 r1bd79e 65 65 Walker = World::getInstance().createAtom(); 66 66 Walker->type = hydrogen; 67 Walker->node->Init(1., 0., 1. );67 *Walker->node = Vector(1., 0., 1. ); 68 68 TestMolecule->AddAtom(Walker); 69 69 Walker = World::getInstance().createAtom(); 70 70 Walker->type = hydrogen; 71 Walker->node->Init(0., 1., 1. );71 *Walker->node = Vector(0., 1., 1. ); 72 72 TestMolecule->AddAtom(Walker); 73 73 Walker = World::getInstance().createAtom(); 74 74 Walker->type = hydrogen; 75 Walker->node->Init(1., 1., 0. );75 *Walker->node = Vector(1., 1., 0. ); 76 76 TestMolecule->AddAtom(Walker); 77 77 Walker = World::getInstance().createAtom(); 78 78 Walker->type = hydrogen; 79 Walker->node->Init(0., 0., 0. );79 *Walker->node = Vector(0., 0., 0. ); 80 80 TestMolecule->AddAtom(Walker); 81 81 -
src/unittests/listofbondsunittest.cpp
r273382 r1bd79e 58 58 Walker = World::getInstance().createAtom(); 59 59 Walker->type = hydrogen; 60 Walker->node->Init(1., 0., 1. );61 TestMolecule->AddAtom(Walker); 62 Walker = World::getInstance().createAtom(); 63 Walker->type = hydrogen; 64 Walker->node->Init(0., 1., 1. );65 TestMolecule->AddAtom(Walker); 66 Walker = World::getInstance().createAtom(); 67 Walker->type = hydrogen; 68 Walker->node->Init(1., 1., 0. );69 TestMolecule->AddAtom(Walker); 70 Walker = World::getInstance().createAtom(); 71 Walker->type = hydrogen; 72 Walker->node->Init(0., 0., 0. );60 *Walker->node = Vector(1., 0., 1. ); 61 TestMolecule->AddAtom(Walker); 62 Walker = World::getInstance().createAtom(); 63 Walker->type = hydrogen; 64 *Walker->node = Vector(0., 1., 1. ); 65 TestMolecule->AddAtom(Walker); 66 Walker = World::getInstance().createAtom(); 67 Walker->type = hydrogen; 68 *Walker->node = Vector(1., 1., 0. ); 69 TestMolecule->AddAtom(Walker); 70 Walker = World::getInstance().createAtom(); 71 Walker->type = hydrogen; 72 *Walker->node = Vector(0., 0., 0. ); 73 73 TestMolecule->AddAtom(Walker); 74 74 -
src/unittests/tesselation_boundarytriangleunittest.cpp
r273382 r1bd79e 86 86 87 87 // simple test on y line 88 Point .Init(-1.,0.5,0.);89 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 90 Point .Init(0.,0.5,0.);91 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 92 Point .Init(-4.,0.5,0.);88 Point = Vector(-1.,0.5,0.); 89 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 90 Point = Vector(0.,0.5,0.); 91 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 92 Point = Vector(-4.,0.5,0.); 93 93 CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 94 Point .Init(0.,0.5,0.);94 Point = Vector(0.,0.5,0.); 95 95 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 96 96 97 97 // simple test on x line 98 Point .Init(0.5,-1.,0.);99 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 100 Point .Init(0.5,0.,0.);101 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 102 Point .Init(0.5,-6.,0.);98 Point = Vector(0.5,-1.,0.); 99 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 100 Point = Vector(0.5,0.,0.); 101 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 102 Point = Vector(0.5,-6.,0.); 103 103 CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 104 Point .Init(0.5,0.,0.);104 Point = Vector(0.5,0.,0.); 105 105 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 106 106 107 107 // simple test on slanted line 108 Point .Init(1.,1.,0.);108 Point = Vector(1.,1.,0.); 109 109 CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 110 Point .Init(0.5,0.5,0.);111 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 112 Point .Init(5.,5.,0.);110 Point = Vector(0.5,0.5,0.); 111 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 112 Point = Vector(5.,5.,0.); 113 113 CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 114 Point .Init(0.5,0.5,0.);114 Point = Vector(0.5,0.5,0.); 115 115 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 116 116 117 117 // simple test on first node 118 Point .Init(-1.,-1.,0.);118 Point = Vector(-1.,-1.,0.); 119 119 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 120 Point .Init(0.,0.,0.);120 Point = Vector(0.,0.,0.); 121 121 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 122 122 123 123 // simple test on second node 124 Point .Init(0.,2.,0.);125 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 126 Point .Init(0.,1.,0.);124 Point = Vector(0.,2.,0.); 125 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 126 Point = Vector(0.,1.,0.); 127 127 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 128 128 129 129 // simple test on third node 130 Point .Init(2.,0.,0.);131 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 132 Point .Init(1.,0.,0.);130 Point = Vector(2.,0.,0.); 131 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 132 Point = Vector(1.,0.,0.); 133 133 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 134 134 }; … … 142 142 143 143 // straight down/up 144 Point .Init(1./3.,1./3.,+5.);144 Point = Vector(1./3.,1./3.,+5.); 145 145 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 146 Point .Init(1./3.,1./3.,0.);147 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 148 Point .Init(1./3.,1./3.,-5.);146 Point = Vector(1./3.,1./3.,0.); 147 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 148 Point = Vector(1./3.,1./3.,-5.); 149 149 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 150 Point .Init(1./3.,1./3.,0.);150 Point = Vector(1./3.,1./3.,0.); 151 151 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 152 152 153 153 // simple test on y line 154 Point .Init(-1.,0.5,+2.);154 Point = Vector(-1.,0.5,+2.); 155 155 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 156 Point .Init(0.,0.5,0.);157 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 158 Point .Init(-1.,0.5,-3.);156 Point = Vector(0.,0.5,0.); 157 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 158 Point = Vector(-1.,0.5,-3.); 159 159 CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 160 Point .Init(0.,0.5,0.);160 Point = Vector(0.,0.5,0.); 161 161 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 162 162 163 163 // simple test on x line 164 Point .Init(0.5,-1.,+1.);164 Point = Vector(0.5,-1.,+1.); 165 165 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 166 Point .Init(0.5,0.,0.);167 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 168 Point .Init(0.5,-1.,-2.);166 Point = Vector(0.5,0.,0.); 167 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 168 Point = Vector(0.5,-1.,-2.); 169 169 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 170 Point .Init(0.5,0.,0.);170 Point = Vector(0.5,0.,0.); 171 171 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 172 172 173 173 // simple test on slanted line 174 Point .Init(1.,1.,+3.);174 Point = Vector(1.,1.,+3.); 175 175 CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 176 Point .Init(0.5,0.5,0.);177 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 178 Point .Init(1.,1.,-4.);176 Point = Vector(0.5,0.5,0.); 177 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 178 Point = Vector(1.,1.,-4.); 179 179 CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 180 Point .Init(0.5,0.5,0.);180 Point = Vector(0.5,0.5,0.); 181 181 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 182 182 183 183 // simple test on first node 184 Point .Init(-1.,-1.,5.);184 Point = Vector(-1.,-1.,5.); 185 185 CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 186 Point .Init(0.,0.,0.);186 Point = Vector(0.,0.,0.); 187 187 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 188 188 189 189 // simple test on second node 190 Point .Init(0.,2.,5.);190 Point = Vector(0.,2.,5.); 191 191 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 192 Point .Init(0.,1.,0.);192 Point = Vector(0.,1.,0.); 193 193 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 194 194 195 195 // simple test on third node 196 Point .Init(2.,0.,5.);196 Point = Vector(2.,0.,5.); 197 197 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 198 Point .Init(1.,0.,0.);199 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 200 }; 198 Point = Vector(1.,0.,0.); 199 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 200 }; -
src/unittests/vectorunittest.cpp
r273382 r1bd79e 26 26 #endif /*HAVE_TESTRUNNER*/ 27 27 28 #include <iostream> 29 30 using namespace std; 31 28 32 /********************************************** Test classes **************************************/ 29 33 … … 34 38 void VectorTest::setUp() 35 39 { 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.); 41 45 }; 42 46 … … 69 73 double factor; 70 74 // copy vector 71 fixture .Init(2.,3.,4.);75 fixture = Vector(2.,3.,4.); 72 76 CPPUNIT_ASSERT_EQUAL( Vector(2.,3.,4.), fixture ); 73 77 // summation and scaling … … 223 227 void VectorTest::VectorRotationTest() 224 228 { 225 fixture .Init(-1.,0.,0.);229 fixture = Vector(-1.,0.,0.); 226 230 227 231 // zero vector does not change … … 266 270 parallelepiped[8] = 1; 267 271 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); 271 275 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.); 277 281 CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) ); 278 fixture .Init(2.,3.,2.);282 fixture = Vector(2.,3.,2.); 279 283 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.