- File:
-
- 1 edited
-
src/unittests/bondgraphunittest.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/bondgraphunittest.cpp
r9a7186 re5ad5c 19 19 #include "bondgraph.hpp" 20 20 #include "element.hpp" 21 #include "log.hpp" 21 22 #include "molecule.hpp" 22 23 #include "periodentafel.hpp" … … 41 42 hydrogen = new element; 42 43 hydrogen->Z = 1; 44 hydrogen->CovalentRadius = 0.23; 45 hydrogen->VanDerWaalsRadius = 1.09; 43 46 strcpy(hydrogen->name, "hydrogen"); 44 47 strcpy(hydrogen->symbol, "H"); 45 48 carbon = new element; 46 carbon->Z = 1; 49 carbon->Z = 2; 50 carbon->CovalentRadius = 0.68; 51 carbon->VanDerWaalsRadius = 1.7; 47 52 strcpy(carbon->name, "carbon"); 48 53 strcpy(carbon->symbol, "C"); … … 57 62 TestMolecule = new molecule(tafel); 58 63 Walker = new atom(); 59 Walker->type = hydrogen;64 Walker->type = carbon; 60 65 Walker->node->Init(1., 0., 1. ); 61 66 TestMolecule->AddAtom(Walker); 62 67 Walker = new atom(); 63 Walker->type = hydrogen;68 Walker->type = carbon; 64 69 Walker->node->Init(0., 1., 1. ); 65 70 TestMolecule->AddAtom(Walker); 66 71 Walker = new atom(); 67 Walker->type = hydrogen;72 Walker->type = carbon; 68 73 Walker->node->Init(1., 1., 0. ); 69 74 TestMolecule->AddAtom(Walker); 70 75 Walker = new atom(); 71 Walker->type = hydrogen;76 Walker->type = carbon; 72 77 Walker->node->Init(0., 0., 0. ); 73 78 TestMolecule->AddAtom(Walker); … … 77 82 78 83 // create a small file with table 84 dummyname = new string("dummy.dat"); 79 85 filename = new string("test.dat"); 80 86 ofstream test(filename->c_str()); … … 82 88 test << "H\t1.\t1.2\n"; 83 89 test << "C\t1.2\t1.5\n"; 84 test.close();85 90 BG = new BondGraph(true); 86 91 }; … … 92 97 remove(filename->c_str()); 93 98 delete(filename); 99 delete(dummyname); 94 100 delete(BG); 95 101 … … 113 119 /** UnitTest for BondGraphTest::ConstructBondGraph(). 114 120 */ 115 void BondGraphTest::ConstructGraph Test()121 void BondGraphTest::ConstructGraphFromTableTest() 116 122 { 117 123 atom *Walker = TestMolecule->start->next; … … 119 125 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 120 126 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(*filename) ); 127 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 128 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) ); 129 }; 130 131 /** UnitTest for BondGraphTest::ConstructBondGraph(). 132 */ 133 void BondGraphTest::ConstructGraphFromCovalentRadiiTest() 134 { 135 atom *Walker = TestMolecule->start->next; 136 atom *Runner = TestMolecule->end->previous; 137 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 138 CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(*dummyname) ); 121 139 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 122 140 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
Note:
See TracChangeset
for help on using the changeset viewer.
