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