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