Changeset d1829c for molecuilder/src/unittests/bondgraphunittest.cpp
- Timestamp:
- Apr 26, 2010, 3:47:54 PM (16 years ago)
- Children:
- bb50e0
- Parents:
- d2390d (diff), aa8542 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
molecuilder/src/unittests/bondgraphunittest.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/unittests/bondgraphunittest.cpp
rd2390d rd1829c 20 20 #include "bondgraph.hpp" 21 21 #include "element.hpp" 22 #include "log.hpp" 22 23 #include "molecule.hpp" 23 24 #include "periodentafel.hpp" … … 42 43 hydrogen = new element; 43 44 hydrogen->Z = 1; 45 hydrogen->CovalentRadius = 0.23; 46 hydrogen->VanDerWaalsRadius = 1.09; 44 47 strcpy(hydrogen->name, "hydrogen"); 45 48 strcpy(hydrogen->symbol, "H"); 46 49 carbon = new element; 47 carbon->Z = 1; 50 carbon->Z = 2; 51 carbon->CovalentRadius = 0.68; 52 carbon->VanDerWaalsRadius = 1.7; 48 53 strcpy(carbon->name, "carbon"); 49 54 strcpy(carbon->symbol, "C"); … … 58 63 TestMolecule = new molecule(tafel); 59 64 Walker = new atom(); 60 Walker->type = hydrogen;65 Walker->type = carbon; 61 66 Walker->node->Init(1., 0., 1. ); 62 67 TestMolecule->AddAtom(Walker); 63 68 Walker = new atom(); 64 Walker->type = hydrogen;69 Walker->type = carbon; 65 70 Walker->node->Init(0., 1., 1. ); 66 71 TestMolecule->AddAtom(Walker); 67 72 Walker = new atom(); 68 Walker->type = hydrogen;73 Walker->type = carbon; 69 74 Walker->node->Init(1., 1., 0. ); 70 75 TestMolecule->AddAtom(Walker); 71 76 Walker = new atom(); 72 Walker->type = hydrogen;77 Walker->type = carbon; 73 78 Walker->node->Init(0., 0., 0. ); 74 79 TestMolecule->AddAtom(Walker); … … 78 83 79 84 // create a small file with table 85 dummyname = new string("dummy.dat"); 80 86 filename = new string("test.dat"); 81 87 ofstream test(filename->c_str()); … … 93 99 remove(filename->c_str()); 94 100 delete(filename); 101 delete(dummyname); 95 102 delete(BG); 96 103 … … 114 121 /** UnitTest for BondGraphTest::ConstructBondGraph(). 115 122 */ 116 void BondGraphTest::ConstructGraph Test()123 void BondGraphTest::ConstructGraphFromTableTest() 117 124 { 118 125 atom *Walker = TestMolecule->start->next; … … 120 127 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 121 128 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(*filename) ); 129 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 130 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) ); 131 }; 132 133 /** UnitTest for BondGraphTest::ConstructBondGraph(). 134 */ 135 void BondGraphTest::ConstructGraphFromCovalentRadiiTest() 136 { 137 atom *Walker = TestMolecule->start->next; 138 atom *Runner = TestMolecule->end->previous; 139 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 140 CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(*dummyname) ); 122 141 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 123 142 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
Note:
See TracChangeset
for help on using the changeset viewer.
