Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/bondgraphunittest.cpp

    re5ad5c r49e1ae  
    1414#include <iostream>
    1515#include <stdio.h>
     16#include <cstring>
    1617
    1718#include "atom.hpp"
     
    1920#include "bondgraph.hpp"
    2021#include "element.hpp"
    21 #include "log.hpp"
    2222#include "molecule.hpp"
    2323#include "periodentafel.hpp"
     
    4242  hydrogen = new element;
    4343  hydrogen->Z = 1;
    44   hydrogen->CovalentRadius = 0.23;
    45   hydrogen->VanDerWaalsRadius = 1.09;
    4644  strcpy(hydrogen->name, "hydrogen");
    4745  strcpy(hydrogen->symbol, "H");
    4846  carbon = new element;
    49   carbon->Z = 2;
    50   carbon->CovalentRadius = 0.68;
    51   carbon->VanDerWaalsRadius = 1.7;
     47  carbon->Z = 1;
    5248  strcpy(carbon->name, "carbon");
    5349  strcpy(carbon->symbol, "C");
     
    6258  TestMolecule = new molecule(tafel);
    6359  Walker = new atom();
    64   Walker->type = carbon;
     60  Walker->type = hydrogen;
    6561  Walker->node->Init(1., 0., 1. );
    6662  TestMolecule->AddAtom(Walker);
    6763  Walker = new atom();
    68   Walker->type = carbon;
     64  Walker->type = hydrogen;
    6965  Walker->node->Init(0., 1., 1. );
    7066  TestMolecule->AddAtom(Walker);
    7167  Walker = new atom();
    72   Walker->type = carbon;
     68  Walker->type = hydrogen;
    7369  Walker->node->Init(1., 1., 0. );
    7470  TestMolecule->AddAtom(Walker);
    7571  Walker = new atom();
    76   Walker->type = carbon;
     72  Walker->type = hydrogen;
    7773  Walker->node->Init(0., 0., 0. );
    7874  TestMolecule->AddAtom(Walker);
     
    8278
    8379  // create a small file with table
    84   dummyname = new string("dummy.dat");
    8580  filename = new string("test.dat");
    8681  ofstream test(filename->c_str());
     
    8883  test << "H\t1.\t1.2\n";
    8984  test << "C\t1.2\t1.5\n";
     85  test.close();
    9086  BG = new BondGraph(true);
    9187};
     
    9793  remove(filename->c_str());
    9894  delete(filename);
    99   delete(dummyname);
    10095  delete(BG);
    10196
     
    119114/** UnitTest for BondGraphTest::ConstructBondGraph().
    120115 */
    121 void BondGraphTest::ConstructGraphFromTableTest()
     116void BondGraphTest::ConstructGraphTest()
    122117{
    123118  atom *Walker = TestMolecule->start->next;
     
    125120  CPPUNIT_ASSERT( TestMolecule->end != Walker );
    126121  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) );
    139122  CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
    140123  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
Note: See TracChangeset for help on using the changeset viewer.