Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Analysis/unittests/CountBondsUnitTest.cpp

    r94d5ac6 r833b15  
    148148void CountBondsTest::HydrogenBridgeBondsTest()
    149149{
    150   double *mirror = new double[3];
     150  double mirror[3];
    151151  CPPUNIT_ASSERT(mirror != NULL && "could not create array of doubles");
    152152  for (int i=0;i<3;i++)
     
    161161  cout << "Case 1: offset of (3,0,0), hence angles are (104.5, 0, 75.5, 180) < 30." << endl;
    162162  Translator  = Vector(3,0,0);
    163   TestMolecule1->Translate(&Translator);
     163  TestMolecule1->Translate(Translator);
    164164  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    165165  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen, NULL) );
    166166  Translator = Vector(-3,0,0);
    167   TestMolecule1->Translate(&Translator);
     167  TestMolecule1->Translate(Translator);
    168168
    169169  cout << "Case 2: offset of (0,3,0), hence angle are (14.5, 165.5, 90) < 30 (only three, because other 90 is missing due to first H01 only fulfilling H-bond criteria)." << endl;
    170170  Translator = Vector(0,3,0);
    171   TestMolecule1->Translate(&Translator);
     171  TestMolecule1->Translate(Translator);
    172172  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    173173  Translator = Vector(0,-3,0);
    174   TestMolecule1->Translate(&Translator);
     174  TestMolecule1->Translate(Translator);
    175175
    176176  cout << "Case 3: offset of (0,-3,0) and mirror, hence angle are (165.5, 90, 165.5, 90) > 30." << endl;
    177177  Translator = Vector(0,-3,0);
    178   TestMolecule1->Scale((const double ** const)&mirror);
    179   TestMolecule1->Translate(&Translator);
     178  TestMolecule1->Scale(&mirror[0]);
     179  TestMolecule1->Translate(Translator);
    180180  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    181181  Translator = Vector(0,3,0);
    182   TestMolecule1->Translate(&Translator);
    183   TestMolecule1->Scale((const double ** const)&mirror);
     182  TestMolecule1->Translate(Translator);
     183  TestMolecule1->Scale(&mirror[0]);
    184184
    185185  cout << "Case 4: offset of (2,1,0), hence angle are (78, 26.6, 102, 153.4) < 30." << endl;
    186186  Translator = Vector(2,1,0);
    187   TestMolecule1->Translate(&Translator);
     187  TestMolecule1->Translate(Translator);
    188188  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    189189  Translator = Vector(-2,-1,0);
    190   TestMolecule1->Translate(&Translator);
     190  TestMolecule1->Translate(Translator);
    191191
    192192  cout << "Case 5: offset of (0,0,3), hence angle are (90, 90, 90, 90) > 30." << endl;
    193193  Translator = Vector(0,0,3);
    194   TestMolecule1->Translate(&Translator);
     194  TestMolecule1->Translate(Translator);
    195195  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    196196  Translator = Vector(0,0,-3);
    197   TestMolecule1->Translate(&Translator);
     197  TestMolecule1->Translate(Translator);
    198198
    199199  cout << "Case 6: offset of (-3,0,0) and mirror, hence angle are (75.5, 180, 104.5, 180) > 30." << endl;
    200200  Translator = Vector(-3,0,0);
    201   TestMolecule1->Scale((const double ** const)&mirror);
    202   TestMolecule1->Translate(&Translator);
     201  TestMolecule1->Scale(&mirror[0]);
     202  TestMolecule1->Translate(Translator);
    203203  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    204204  Translator = Vector(3,0,0);
    205   TestMolecule1->Translate(&Translator);
    206   TestMolecule1->Scale((const double ** const)&mirror);
     205  TestMolecule1->Translate(Translator);
     206  TestMolecule1->Scale(&mirror[0]);
    207207
    208208  cout << "Case 7: offset of (3,0,0) and mirror, hence angles are (104.5, 0, 104.5, 0) < 30, but interfering hydrogens." << endl;
    209209  Translator = Vector(3,0,0);
    210   TestMolecule1->Scale((const double ** const)&mirror);
    211   TestMolecule1->Translate(&Translator);
     210  TestMolecule1->Scale(&mirror[0]);
     211  TestMolecule1->Translate(Translator);
    212212  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    213213  Translator = Vector(-3,0,0);
    214   TestMolecule1->Translate(&Translator);
    215   TestMolecule1->Scale((const double ** const)&mirror);
     214  TestMolecule1->Translate(Translator);
     215  TestMolecule1->Scale(&mirror[0]);
    216216
    217217  cout << "Case 8: offset of (0,3,0), hence angle are (14.5, 90, 14.5, 90) < 30, but interfering hydrogens." << endl;
    218218  Translator = Vector(0,3,0);
    219   TestMolecule1->Scale((const double ** const)&mirror);
    220   TestMolecule1->Translate(&Translator);
     219  TestMolecule1->Scale(&mirror[0]);
     220  TestMolecule1->Translate(Translator);
    221221  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
    222222  Translator = Vector(0,-3,0);
    223   TestMolecule1->Translate(&Translator);
    224   TestMolecule1->Scale((const double ** const)&mirror);
    225 
    226   delete[](mirror);
    227 };
     223  TestMolecule1->Translate(Translator);
     224  TestMolecule1->Scale(&mirror[0]);
     225};
Note: See TracChangeset for help on using the changeset viewer.