Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/bondgraphunittest.cpp

    re5ad5c r9a7186  
    1919#include "bondgraph.hpp"
    2020#include "element.hpp"
    21 #include "log.hpp"
    2221#include "molecule.hpp"
    2322#include "periodentafel.hpp"
     
    4241  hydrogen = new element;
    4342  hydrogen->Z = 1;
    44   hydrogen->CovalentRadius = 0.23;
    45   hydrogen->VanDerWaalsRadius = 1.09;
    4643  strcpy(hydrogen->name, "hydrogen");
    4744  strcpy(hydrogen->symbol, "H");
    4845  carbon = new element;
    49   carbon->Z = 2;
    50   carbon->CovalentRadius = 0.68;
    51   carbon->VanDerWaalsRadius = 1.7;
     46  carbon->Z = 1;
    5247  strcpy(carbon->name, "carbon");
    5348  strcpy(carbon->symbol, "C");
     
    6257  TestMolecule = new molecule(tafel);
    6358  Walker = new atom();
    64   Walker->type = carbon;
     59  Walker->type = hydrogen;
    6560  Walker->node->Init(1., 0., 1. );
    6661  TestMolecule->AddAtom(Walker);
    6762  Walker = new atom();
    68   Walker->type = carbon;
     63  Walker->type = hydrogen;
    6964  Walker->node->Init(0., 1., 1. );
    7065  TestMolecule->AddAtom(Walker);
    7166  Walker = new atom();
    72   Walker->type = carbon;
     67  Walker->type = hydrogen;
    7368  Walker->node->Init(1., 1., 0. );
    7469  TestMolecule->AddAtom(Walker);
    7570  Walker = new atom();
    76   Walker->type = carbon;
     71  Walker->type = hydrogen;
    7772  Walker->node->Init(0., 0., 0. );
    7873  TestMolecule->AddAtom(Walker);
     
    8277
    8378  // create a small file with table
    84   dummyname = new string("dummy.dat");
    8579  filename = new string("test.dat");
    8680  ofstream test(filename->c_str());
     
    8882  test << "H\t1.\t1.2\n";
    8983  test << "C\t1.2\t1.5\n";
     84  test.close();
    9085  BG = new BondGraph(true);
    9186};
     
    9792  remove(filename->c_str());
    9893  delete(filename);
    99   delete(dummyname);
    10094  delete(BG);
    10195
     
    119113/** UnitTest for BondGraphTest::ConstructBondGraph().
    120114 */
    121 void BondGraphTest::ConstructGraphFromTableTest()
     115void BondGraphTest::ConstructGraphTest()
    122116{
    123117  atom *Walker = TestMolecule->start->next;
     
    125119  CPPUNIT_ASSERT( TestMolecule->end != Walker );
    126120  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) );
    139121  CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
    140122  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
Note: See TracChangeset for help on using the changeset viewer.