maxsizevector.cpp File Reference
#include "main.h"
#include <exception>
#include <Eigen/src/Core/util/MaxSizeVector.h>

Classes

struct  Foo
 
class  Foo::Fail
 

Functions

 EIGEN_DECLARE_TEST (cxx11_maxsizevector)
 

Function Documentation

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( cxx11_maxsizevector  )
41  {
44  for (int r = 0; r < g_repeat; r++) {
45  Index rows = internal::random<Index>(3, 30);
46  Foo::object_limit = internal::random<Index>(0, rows - 2);
47  std::cout << "object_limit = " << Foo::object_limit << std::endl;
48  bool exception_raised = false;
49 #ifdef EIGEN_EXCEPTIONS
50  try {
51 #endif
52  std::cout << "\nVectorX m(" << rows << ");\n";
53  VectorX vect(rows);
54  for (int i = 0; i < rows; ++i) vect.push_back(Foo());
55 #ifdef EIGEN_EXCEPTIONS
56  VERIFY(false); // not reached if exceptions are enabled
57  } catch (const Foo::Fail&) {
58  exception_raised = true;
59  }
60  VERIFY(exception_raised);
61 #endif
63 
64  {
65  Foo::object_limit = rows + 1;
66  VectorX vect2(rows, Foo());
68  }
70  std::cout << '\n';
71  }
72 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
@ Foo
Definition: bug1213.cpp:3
The MaxSizeVector class.
Definition: MaxSizeVector.h:31
Definition: ctorleak.cpp:27
#define VERIFY(a)
Definition: main.h:362
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
static int g_repeat
Definition: main.h:191
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Definition: jacobisvd.cpp:97
r
Definition: UniformPSDSelfTest.py:20
Matrix< Scalar, Dynamic, 1 > VectorX
Definition: sparse_lu.cpp:43
static Index object_limit
Definition: ctorleak.cpp:7
static Index object_count
Definition: ctorleak.cpp:6

References Foo, Eigen::g_repeat, i, Foo::object_count, Foo::object_limit, UniformPSDSelfTest::r, rows, VERIFY, and VERIFY_IS_EQUAL.