MCPcopy Create free account
hub / github.com/PX4/eigen / test_nomalloc

Function test_nomalloc

test/nomalloc.cpp:206–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206void test_nomalloc()
207{
208 // create some dynamic objects
209 Eigen::MatrixXd M1 = MatrixXd::Random(3,3);
210 Ref<const MatrixXd> R1 = 2.0*M1; // Ref requires temporary
211
212 // from here on prohibit malloc:
213 Eigen::internal::set_is_malloc_allowed(false);
214
215 // check that our operator new is indeed called:
216 VERIFY_RAISES_ASSERT(MatrixXd dummy(MatrixXd::Random(3,3)));
217 CALL_SUBTEST_1(nomalloc(Matrix<float, 1, 1>()) );
218 CALL_SUBTEST_2(nomalloc(Matrix4d()) );
219 CALL_SUBTEST_3(nomalloc(Matrix<float,32,32>()) );
220
221 // Check decomposition modules with dynamic matrices that have a known compile-time max size (ctms)
222 CALL_SUBTEST_4(ctms_decompositions<float>());
223
224 CALL_SUBTEST_5(test_zerosized());
225
226 CALL_SUBTEST_6(test_reference(Matrix<float,32,32>()));
227 CALL_SUBTEST_7(test_reference(R1));
228 CALL_SUBTEST_8(Ref<MatrixXd> R2 = M1.topRows<2>(); test_reference(R2));
229}

Callers

nothing calls this directly

Calls 4

set_is_malloc_allowedFunction · 0.85
nomallocFunction · 0.85
test_referenceFunction · 0.85
test_zerosizedFunction · 0.70

Tested by

no test coverage detected