From 9e8f437a6f3f2184a8b62cd193c5611a9a9b8127 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 11 Jan 2009 21:59:04 +0000 Subject: extend stdvector test with more push_back... --- test/stdvector.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'test/stdvector.cpp') diff --git a/test/stdvector.cpp b/test/stdvector.cpp index d14b85f95..ea57c0736 100644 --- a/test/stdvector.cpp +++ b/test/stdvector.cpp @@ -40,15 +40,25 @@ void check_stdvector(const MatrixType& m) { VERIFY_IS_APPROX(w[i], v[i]); } - + v.resize(21); v[20].set(x); VERIFY_IS_APPROX(v[20], x); v.resize(22,y); - VERIFY_IS_APPROX(v[21], y); + VERIFY_IS_APPROX(v[21], y); 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