Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/MatrixUnittest.cpp

    rbcf653 r57f243  
    1 /*
    2  * Project: MoleCuilder
    3  * Description: creates and alters molecular systems
    4  * Copyright (C)  2010 University of Bonn. All rights reserved.
    5  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
    6  */
    7 
    81/*
    92 * MatrixUnittest.cpp
     
    136 */
    147
    15 // include config.h
    16 #ifdef HAVE_CONFIG_H
    17 #include <config.h>
    18 #endif
    19 
    208#include <cppunit/CompilerOutputter.h>
    219#include <cppunit/extensions/TestFactoryRegistry.h>
    2210#include <cppunit/ui/text/TestRunner.h>
    23 
    24 #include <cmath>
    2511
    2612#include "MatrixUnittest.hpp"
     
    165151    }
    166152  }
    167 }
    168 
    169 void MatrixUnittest::TransposeTest(){
    170   Matrix res;
    171 
    172   // transpose of unit is unit
    173   res.one();
    174   (const Matrix)res.transpose();
    175   CPPUNIT_ASSERT_EQUAL(res,*one);
    176 
    177   // transpose of transpose is same matrix
    178   res.zero();
    179   res.set(2,2, 1.);
    180   CPPUNIT_ASSERT_EQUAL(res.transpose().transpose(),res);
    181153}
    182154
     
    253225}
    254226
    255 void MatrixUnittest::RotationTest(){
    256   Matrix res;
    257   Matrix inverse;
    258 
    259   // zero rotation angles yields unity matrix
    260   res.rotation(0,0,0);
    261   CPPUNIT_ASSERT_EQUAL(*one, res);
    262 
    263   // arbitrary rotation matrix has det = 1
    264   res.rotation(M_PI/3.,1.,M_PI/7.);
    265   CPPUNIT_ASSERT(fabs(fabs(res.determinant()) -1.) < MYEPSILON);
    266 
    267   // inverse is rotation matrix with negative angles
    268   res.rotation(M_PI/3.,0.,0.);
    269   inverse.rotation(-M_PI/3.,0.,0.);
    270   CPPUNIT_ASSERT_EQUAL(*one, res * inverse);
    271 
    272   // ... or transposed
    273   res.rotation(M_PI/3.,0.,0.);
    274   CPPUNIT_ASSERT_EQUAL(inverse, ((const Matrix) res).transpose());
    275 }
    276227
    277228void MatrixUnittest::InvertTest(){
Note: See TracChangeset for help on using the changeset viewer.