matfileIOTest.hh

Go to the documentation of this file.
1 
8 #ifndef matlabmatfiletest_hh
9 #define matlabmatfiletest_hh
10 
11 #include "matfile/matfileIO.hh"
12 #include "basics/testcase.hh"
13 
14 namespace test {
15 
16  // ****************************************************** MatfileIOTest **
17 
22  class MatfileIOTest: public TestCase {
23 
24  public:
26 
27  virtual ~MatfileIOTest() {
28  };
29 
30  virtual void run();
31 
32  private:
33 
34  //##########################################################################
35  // basic routine section
36  //##########################################################################
37 
41  void testBasics_();
42 
43  //##########################################################################
44  // add section
45  //##########################################################################
46 
50  template<typename F>
51  void testAddSth_(F& obj);
52 
56  template<typename F, typename G>
57  void testAddSthOtherCmp_(F& obj_F, G& obj_G);
58 
59  //##########################################################################
60  // get section
61  //##########################################################################
62 
66  void testGetSth_();
67 
68  //##################################################################################
69  // compare routines for all used data structures
70  //##################################################################################
71 
72  template<class F>
75  template<class F>
77  template<class F>
80  template<class F>
82  template<class F>
84  template<class F>
88 
89  //this is in hh file since it is not apriory clear what dims the mapping could have if there is a error
90  template<class F, uint dim1, uint dim2>
93  if (dim1 != dim2) {
94  _fail("Dimension fails");
95  return false;
96  }
97  for (uint i = 0; i < dim1; i++)
98  for (uint j = 0; j < dim1; j++)
99  if (m1(i, j) != m2(i, j)) {
100  _fail("Mapping entries differ");
101  return false;
102  }
103  return true;
104  }
105 
106  template<class F, uint dim1, uint dim2>
108  if (dim1 != dim2) {
109  _fail("Dimension fails");
110  return false;
111  }
112  for (uint i = 0; i < dim1; i++)
113  if (m1[i] != m2[i]) {
114  _fail("Point entries differ");
115  return false;
116  }
117  return true;
118  }
119 
120  //##################################################################################
121  // create a octave matfile to read with MatfileIO
122  //##################################################################################
123 
124  void createMATfile() const;
125 
126  //##########################################################################
127  // clear section
128  //##########################################################################
129 
134 
135  };
136 
137 } // namespace test
138 
139 #endif
Basic class for a 2D or 3D map.
bool isEqual_(concepts::DiagonalMatrix< F > &m1, concepts::DiagonalMatrix< F > &m2)
bool isEqual_(concepts::Array< F > &m1, concepts::Array< F > &m2)
Test for class MatfileIO.
void testAddSthOtherCmp_(F &obj_F, G &obj_G)
Test for adding Array<Point>
Base class for tests.
Definition: testcase.hh:92
virtual ~MatfileIOTest()
Basic class for a Point or a vector.
void testClearAll_()
Test for clearing the MAT file.
bool isEqual_(concepts::Cmplx &m1, concepts::Cmplx &m2)
bool isEqual_(concepts::Vector< F > &m1, concepts::Vector< F > &m2)
void createMATfile() const
bool isEqual_(concepts::Point< F, dim1 > &m1, concepts::Point< F, dim2 > &m2)
void testGetSth_()
Test for getting ElementMatrix, SparseMatrix, DiagonalMatrix, Sequence, Vector, Sequence<Vector> Arra...
bool isEqual_(concepts::ElementMatrix< F > &m1, concepts::ElementMatrix< F > &m2)
virtual void run()
Runs the tests. Must be overwritten by the specialization.
void testBasics_()
Test for public methods.
Unit tests.
Definition: testcase.hh:66
bool isEqual_(concepts::Sequence< F > &m1, concepts::Sequence< F > &m2)
void testAddSth_(F &obj)
Test for adding ElementMatrix, SparseMatrix, DiagonalMatrix, Sequence, Vector, Array,...
An array of objects.
Definition: bilinearForm.hh:23
bool isEqual_(concepts::Mapping< F, dim1 > &m1, concepts::Mapping< F, dim2 > &m2)
Sequence with operations, output operator, and method of the particular element types.
Definition: sequence.hh:39
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition: typedefs.hh:39
Diagonal matrix.
Definition: diagonal.hh:24
Element matrix.
Definition: linearForm.hh:18
bool isEqual_(concepts::SparseMatrix< F > &m1, concepts::SparseMatrix< F > &m2)
#define _fail(str)
Explicitly fails a test.
Definition: testcase.hh:82
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
bool isEqual_(concepts::Real &m1, concepts::Real &m2)
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich