12 #define VERIFY_THROWS_BADALLOC(a) { \
17 catch (std::bad_alloc&) { threw = true; } \
18 VERIFY(threw && "should have thrown bad_alloc: " #a); \
21 template<
typename MatrixType>
29 template<
typename VectorType>
44 size_t times_itself_gives_0 =
size_t(1) << (8 *
sizeof(
Index) / 2);
45 VERIFY(times_itself_gives_0 * times_itself_gives_0 == 0);
47 size_t times_4_gives_0 =
size_t(1) << (8 *
sizeof(
Index) - 2);
48 VERIFY(times_4_gives_0 * 4 == 0);
50 size_t times_8_gives_0 =
size_t(1) << (8 *
sizeof(
Index) - 3);
51 VERIFY(times_8_gives_0 * 8 == 0);
53 triggerMatrixBadAlloc<MatrixXf>(times_itself_gives_0, times_itself_gives_0);
54 triggerMatrixBadAlloc<MatrixXf>(times_itself_gives_0 / 4, times_itself_gives_0);
55 triggerMatrixBadAlloc<MatrixXf>(times_4_gives_0, 1);
57 triggerMatrixBadAlloc<MatrixXd>(times_itself_gives_0, times_itself_gives_0);
58 triggerMatrixBadAlloc<MatrixXd>(times_itself_gives_0 / 8, times_itself_gives_0);
59 triggerMatrixBadAlloc<MatrixXd>(times_8_gives_0, 1);
61 triggerVectorBadAlloc<VectorXf>(times_4_gives_0);
63 triggerVectorBadAlloc<VectorXd>(times_8_gives_0);