Back to index

salome-med  6.5.0
InterpolationPlanarTestSuite.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__
00021 #define __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__
00022 
00023 #include <cppunit/extensions/HelperMacros.h>
00024 #include <deque>
00025 #include <cmath>
00026 #include <iostream>
00027 
00028 namespace INTERP_TEST
00029 {
00030 
00035   class InterpolationPlanarTestSuite : public CppUnit::TestFixture
00036   {
00037 
00038   public:
00039     double _Epsilon;
00040     double _Precision;
00041 
00046     void setUp()
00047     {
00048       _Epsilon = 1.e-6;
00049       _Precision = 1.e-6;
00050     }
00051     void tearDown()  {}
00052 
00053     //     bool checkDequesEqual(std::deque< double > deque1, std::deque< double > deque2, double epsilon);
00054     //     bool checkVectorsEqual(std::vector< double > Vect1, std::vector< double > Vect2, double epsilon);
00055     //     void dequePrintOut(std::deque< double > deque1);
00056     //     void vectPrintOut(std::vector< double > vect);
00057     //     void tabPrintOut( const double * tab, int size);
00058 
00059     bool checkDequesEqual(std::deque< double > deque1,  
00060                           std::deque< double > deque2, double epsilon)
00061     {
00062       int size1 = deque1.size();
00063       int size2 = deque2.size();
00064       bool are_equal = size1 == size2;
00065     
00066       if(are_equal)
00067         for(int i = 0; i < size1 && are_equal; i++)
00068           are_equal = fabs(deque1[i] - deque2[i]) < epsilon;
00069       
00070       return are_equal; 
00071     }
00072     bool checkVectorsEqual(std::vector< double > vect1,  
00073                            std::vector< double > vect2, double epsilon)
00074     {
00075       int size1 = vect1.size();
00076       int size2 = vect2.size();
00077       bool are_equal = size1 == size2;
00078       
00079       if(are_equal)
00080         for(int i = 0; i < size1 && are_equal; i++)
00081           are_equal = fabs(vect1[i] - vect2[i]) < epsilon;
00082       
00083       return are_equal; 
00084     }
00085     void dequePrintOut(std::deque< double > deque1)
00086     {
00087       for(int i = 0; i< (int)deque1.size(); i++)
00088         {
00089           std::cerr << deque1[i] << " ";
00090         }
00091       std::cerr<< std::endl;
00092     }
00093     void vectPrintOut(std::vector< double > vect)
00094     {
00095       for(int i = 0; i< (int)vect.size(); i++)
00096         {
00097           std::cerr << vect[i] << " ";
00098         }
00099       std::cerr<< std::endl;
00100     }  
00101     void tabPrintOut( const double * tab,int size)
00102     {
00103       for(int i = 0; i< size; i++)
00104         {
00105           std::cerr << tab[i] << " ";
00106         }
00107       std::cerr<< std::endl;
00108     }  
00109 
00114     //     void tearDown()
00115     //     {
00116     //       delete _testTools;
00117     //     }
00118 
00119     
00120 
00121     //   protected:
00122     //     /// MeshTestToolkit object to which the tests are delegated
00123     //     MeshTestToolkit* _testTools; 
00124 
00125   };
00126 }
00127 #endif