mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-11-21 03:11:25 +08:00
extend stdvector test with more push_back...
This commit is contained in:
parent
824b75f182
commit
9e8f437a6f
@ -187,6 +187,6 @@ ei_add_test(parametrizedline)
|
||||
ei_add_test(alignedbox)
|
||||
ei_add_test(regression)
|
||||
ei_add_test(stdvector)
|
||||
ei_add_test(sparse_basic " " "${SPARSE_LIBS}")
|
||||
ei_add_test(sparse_vector " " "${SPARSE_LIBS}")
|
||||
ei_add_test(sparse_basic)
|
||||
ei_add_test(sparse_vector)
|
||||
ei_add_test(sparse_solvers " " "${SPARSE_LIBS}")
|
||||
|
@ -49,6 +49,16 @@ void check_stdvector(const MatrixType& m)
|
||||
v.push_back(x);
|
||||
VERIFY_IS_APPROX(v[22], x);
|
||||
VERIFY((size_t)&(v[22]) == (size_t)&(v[21]) + sizeof(MatrixType));
|
||||
|
||||
// do a lot of push_back such that the vector gets internally resized
|
||||
// (with memory reallocation)
|
||||
MatrixType* ref = &w[0];
|
||||
for(int i=0; i<30 | ((ref==&w[0]) && i<300); ++i)
|
||||
v.push_back(w[i%w.size()]);
|
||||
for(int i=23; i<v.size(); ++i)
|
||||
{
|
||||
VERIFY(v[i]==w[(i-23)%w.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
void test_stdvector()
|
||||
|
Loading…
Reference in New Issue
Block a user