source: src/unittests/LinkedCellUnitTest.cpp@ a3696f

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
Last change on this file since a3696f was dcea0f, checked in by heber <heber@…>, 15 years ago

New Unit test for class LinkedCell.

  • this is just the skeleton, so far it does nothing useful.

Signed-off-by: heber <heber@…>

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * LinkedCellUnitTest.cpp
3 *
4 * Created on: Apr 9, 2010
5 * Author: heber
6 */
7
8using namespace std;
9
10#include <cppunit/CompilerOutputter.h>
11#include <cppunit/extensions/TestFactoryRegistry.h>
12#include <cppunit/ui/text/TestRunner.h>
13
14#include <iostream>
15#include <stdio.h>
16#include <cstring>
17
18#include "atom.hpp"
19#include "element.hpp"
20#include "linkedcell.hpp"
21#include "molecule.hpp"
22#include "periodentafel.hpp"
23#include "LinkedCellUnitTest.hpp"
24
25/********************************************** Test classes **************************************/
26
27// Registers the fixture into the 'registry'
28CPPUNIT_TEST_SUITE_REGISTRATION( LinkedCellTest );
29
30
31void LinkedCellTest::setUp()
32{
33 atom *Walker = NULL;
34
35 // init private all pointers to zero
36 TestMolecule = NULL;
37 hydrogen = NULL;
38 tafel = NULL;
39
40 // construct element
41 hydrogen = new element;
42 hydrogen->Z = 1;
43 hydrogen->CovalentRadius = 0.23;
44 strcpy(hydrogen->name, "hydrogen");
45 strcpy(hydrogen->symbol, "H");
46
47 // construct periodentafel
48 tafel = new periodentafel;
49 tafel->AddElement(hydrogen);
50
51 // construct molecule (water molecule)
52 TestMolecule = new molecule(tafel);
53 Walker = new atom();
54 Walker->type = hydrogen;
55 Walker->node->Init(0., 0., 0. );
56 TestMolecule->AddAtom(Walker);
57
58 // check that TestMolecule was correctly constructed
59 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 1 );
60 Walker = TestMolecule->start->next;
61 CPPUNIT_ASSERT( TestMolecule->end != Walker );
62
63 // construct linked cell
64 LC = new LinkedCell (TestMolecule, 1.);
65};
66
67
68void LinkedCellTest::tearDown()
69{
70 delete(LC);
71 delete(TestMolecule);
72 // note that all the atoms are cleaned by TestMolecule
73 delete(tafel);
74 // note that element is cleaned by periodentafel
75};
76
77
78/** UnitTest for LinkedCell::GetCurrentCell().
79 */
80void LinkedCellTest::GetCurrentCellTest()
81{
82 CPPUNIT_ASSERT_EQUAL( true, true );
83};
84
85/** UnitTest for LinkedCell::GetRelativeToCurrentCell().
86 */
87void LinkedCellTest::GetRelativeToCurrentCellTest()
88{
89 CPPUNIT_ASSERT_EQUAL( true, true );
90};
91
92
93/** UnitTest for LinkedCell::SetIndexToNode().
94 */
95void LinkedCellTest::SetIndexToNodeTest()
96{
97 CPPUNIT_ASSERT_EQUAL( true, true );
98};
99
100
101/** UnitTest for LinkedCell::SetIndexToVector().
102 */
103void LinkedCellTest::SetIndexToVectorTest()
104{
105 CPPUNIT_ASSERT_EQUAL( true, true );
106};
107
108
109/** UnitTest for LinkedCell::CheckBounds().
110 */
111void LinkedCellTest::CheckBoundsTest()
112{
113 CPPUNIT_ASSERT_EQUAL( true, true );
114};
115
116
117/** UnitTest for LinkedCell::GetNeighbourBounds().
118 */
119void LinkedCellTest::GetNeighbourBoundsTest()
120{
121 CPPUNIT_ASSERT_EQUAL( true, true );
122};
123
124
125/** UnitTest for LinkedCell::GetallNeighbours().
126 */
127void LinkedCellTest::GetallNeighboursTest()
128{
129 CPPUNIT_ASSERT_EQUAL( true, true );
130};
131
132
133/** UnitTest for LinkedCell::GetPointsInsideSphere().
134 */
135void LinkedCellTest::GetPointsInsideSphereTest()
136{
137 CPPUNIT_ASSERT_EQUAL( true, true );
138};
139
140/********************************************** Main routine **************************************/
141
142int main(int argc, char **argv)
143{
144 // Get the top level suite from the registry
145 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
146
147 // Adds the test to the list of test to run
148 CppUnit::TextUi::TestRunner runner;
149 runner.addTest( suite );
150
151 // Change the default outputter to a compiler error format outputter
152 runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
153 std::cerr ) );
154 // Run the tests.
155 bool wasSucessful = runner.run();
156
157 // Return error code 1 if the one of test failed.
158 return wasSucessful ? 0 : 1;
159};
160
Note: See TracBrowser for help on using the repository browser.