- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/CountBondsUnitTest.cpp
r920c70 rd74077 54 54 Walker = World::getInstance().createAtom(); 55 55 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 56 Walker-> type = hydrogen;57 *Walker->node = Vector(-0.2418, 0.9350, 0.);56 Walker->setType(hydrogen); 57 Walker->setPosition(Vector(-0.2418, 0.9350, 0. )); 58 58 TestMolecule1->AddAtom(Walker); 59 59 Walker = World::getInstance().createAtom(); 60 60 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 61 Walker-> type = hydrogen;62 *Walker->node = Vector(0.9658, 0., 0.);61 Walker->setType(hydrogen); 62 Walker->setPosition(Vector(0.9658, 0., 0. )); 63 63 TestMolecule1->AddAtom(Walker); 64 64 Walker = World::getInstance().createAtom(); 65 65 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 66 Walker-> type = oxygen;67 *Walker->node = Vector(0., 0., 0.);66 Walker->setType(oxygen); 67 Walker->setPosition(Vector(0., 0., 0. )); 68 68 TestMolecule1->AddAtom(Walker); 69 69 … … 72 72 Walker = World::getInstance().createAtom(); 73 73 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 74 Walker-> type = hydrogen;75 *Walker->node = Vector(-0.2418, 0.9350, 0.);74 Walker->setType(hydrogen); 75 Walker->setPosition(Vector(-0.2418, 0.9350, 0. )); 76 76 TestMolecule2->AddAtom(Walker); 77 77 Walker = World::getInstance().createAtom(); 78 78 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 79 Walker-> type = hydrogen;80 *Walker->node = Vector(0.9658, 0., 0.);79 Walker->setType(hydrogen); 80 Walker->setPosition(Vector(0.9658, 0., 0. )); 81 81 TestMolecule2->AddAtom(Walker); 82 82 Walker = World::getInstance().createAtom(); 83 83 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 84 Walker-> type = oxygen;85 *Walker->node = Vector(0., 0., 0.);84 Walker->setType(oxygen); 85 Walker->setPosition(Vector(0., 0., 0. )); 86 86 TestMolecule2->AddAtom(Walker); 87 87 … … 92 92 93 93 // check that TestMolecule was correctly constructed 94 CPPUNIT_ASSERT_EQUAL( TestMolecule1->AtomCount, 3 ); 95 Walker = TestMolecule1->start->next; 96 CPPUNIT_ASSERT( TestMolecule1->end != Walker ); 97 CPPUNIT_ASSERT_EQUAL( TestMolecule2->AtomCount, 3 ); 98 Walker = TestMolecule2->start->next; 99 CPPUNIT_ASSERT( TestMolecule2->end != Walker ); 94 CPPUNIT_ASSERT_EQUAL( TestMolecule1->getAtomCount(), 3 ); 95 CPPUNIT_ASSERT_EQUAL( TestMolecule2->getAtomCount(), 3 ); 100 96 101 97 // create a small file with table … … 158 154 Translator = Vector(3,0,0); 159 155 TestMolecule2->Translate(&Translator); 160 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL ) );161 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen ) );156 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 157 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen, NULL) ); 162 158 //OutputTestMolecule(TestMolecule2, "testmolecule2-1.xyz"); 163 159 Translator = Vector(-3,0,0); … … 167 163 Translator = Vector(0,3,0); 168 164 TestMolecule2->Translate(&Translator); 169 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL ) );165 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 170 166 //OutputTestMolecule(TestMolecule2, "testmolecule2-2.xyz"); 171 167 Translator = Vector(0,-3,0); … … 176 172 TestMolecule2->Scale((const double ** const)&mirror); 177 173 TestMolecule2->Translate(&Translator); 178 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL ) );174 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 179 175 //OutputTestMolecule(TestMolecule2, "testmolecule2-3.xyz"); 180 176 Translator = Vector(0,3,0); … … 185 181 Translator = Vector(2,1,0); 186 182 TestMolecule2->Translate(&Translator); 187 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL ) );183 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 188 184 //OutputTestMolecule(TestMolecule2, "testmolecule2-4.xyz"); 189 185 Translator = Vector(-2,-1,0); … … 193 189 Translator = Vector(0,0,3); 194 190 TestMolecule2->Translate(&Translator); 195 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL ) );191 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 196 192 //OutputTestMolecule(TestMolecule2, "testmolecule2-5.xyz"); 197 193 Translator = Vector(0,0,-3); … … 202 198 TestMolecule2->Scale((const double ** const)&mirror); 203 199 TestMolecule2->Translate(&Translator); 204 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL ) );200 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 205 201 //OutputTestMolecule(TestMolecule2, "testmolecule2-6.xyz"); 206 202 Translator = Vector(3,0,0); … … 212 208 TestMolecule2->Scale((const double ** const)&mirror); 213 209 TestMolecule2->Translate(&Translator); 214 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL ) );210 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 215 211 //OutputTestMolecule(TestMolecule2, "testmolecule2-7.xyz"); 216 212 Translator = Vector(-3,0,0); … … 223 219 TestMolecule2->Translate(&Translator); 224 220 //OutputTestMolecule(TestMolecule2, "testmolecule2-8.xyz"); 225 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL ) );221 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 226 222 Translator = Vector(0,-3,0); 227 223 TestMolecule2->Translate(&Translator);
Note:
See TracChangeset
for help on using the changeset viewer.