Changeset aa8542 for molecuilder/src/unittests/bondgraphunittest.cpp
- Timestamp:
- Apr 26, 2010, 3:42:45 PM (15 years ago)
- Children:
- d1829c
- Parents:
- 543ce4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/unittests/bondgraphunittest.cpp
r543ce4 raa8542 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()); … … 91 97 remove(filename->c_str()); 92 98 delete(filename); 99 delete(dummyname); 93 100 delete(BG); 94 101 … … 112 119 /** UnitTest for BondGraphTest::ConstructBondGraph(). 113 120 */ 114 void BondGraphTest::ConstructGraph Test()121 void BondGraphTest::ConstructGraphFromTableTest() 115 122 { 116 123 atom *Walker = TestMolecule->start->next; … … 118 125 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 119 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) ); 120 139 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 121 140 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
Note:
See TracChangeset
for help on using the changeset viewer.